NEURON
Weibull.h
Go to the documentation of this file.
1 // This may look like C code, but it is really -*- C++ -*-
2 /*
3 Copyright (C) 1988 Free Software Foundation
4  written by Dirk Grunwald (grunwald@cs.uiuc.edu)
5 
6 This file is part of the GNU C++ Library. This library is free
7 software; you can redistribute it and/or modify it under the terms of
8 the GNU Library General Public License as published by the Free
9 Software Foundation; either version 2 of the License, or (at your
10 option) any later version. This library is distributed in the hope
11 that it will be useful, but WITHOUT ANY WARRANTY; without even the
12 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the GNU Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18 #pragma once
19 
20 #include "Random.h"
21 
22 class Weibull: public Random {
23 protected:
24  double pAlpha;
25  double pInvAlpha;
26  double pBeta;
27 
28  void setState();
29 
30 public:
31  Weibull(double alpha, double beta, RNG *gen);
32 
33  double alpha();
34  double alpha(double x);
35 
36  double beta();
37  double beta(double x);
38 
39  virtual double operator()();
40 };
41 
42 
43 inline void Weibull::setState() {
44  pInvAlpha = 1.0 / pAlpha;
45 }
46 
47 inline Weibull::Weibull(double alpha, double beta, RNG *gen) : Random(gen)
48 {
49  pAlpha = alpha;
50  pBeta = beta;
51  setState();
52 }
53 
54 inline double Weibull::alpha() { return pAlpha; }
55 
56 inline double Weibull::alpha(double x) {
57  double tmp = pAlpha;
58  pAlpha = x;
59  setState();
60  return tmp;
61 }
62 
63 inline double Weibull::beta() { return pBeta; };
64 inline double Weibull::beta(double x) {
65  double tmp = pBeta;
66  pBeta = x;
67  return tmp;
68 };
Definition: RNG.h:5
Definition: Random.h:24
void setState()
Definition: Weibull.h:43
double alpha()
Definition: Weibull.h:54
double pInvAlpha
Definition: Weibull.h:25
double pBeta
Definition: Weibull.h:26
double beta()
Definition: Weibull.h:63
Weibull(double alpha, double beta, RNG *gen)
Definition: Weibull.h:47
virtual double operator()()
Definition: Weibull.cpp:29
double pAlpha
Definition: Weibull.h:24
static double alpha(double x)
Definition: synapse.cpp:85