CAFE
Computational Analysis of gene Family Evolution
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
chooseln_cache.h
Go to the documentation of this file.
1
#ifndef CHOOSELN_CACHE_H_2C3C614A_C14D_477A_B8A0_30AE50238D9E
2
#define CHOOSELN_CACHE_H_2C3C614A_C14D_477A_B8A0_30AE50238D9E
3
11
#include <assert.h>
12
13
#include <
mathfunc.h
>
14
#include <
memalloc.h
>
15
16
struct
chooseln_cache
{
17
double
**
values
;
18
int
size
;
19
};
20
21
int
chooseln_is_init2
(
struct
chooseln_cache
*
cache
);
22
int
get_chooseln_cache_size2
(
struct
chooseln_cache
*
cache
);
23
void
chooseln_cache_init2
(
struct
chooseln_cache
*
cache
,
int
size);
24
void
chooseln_cache_resize2
(
struct
chooseln_cache
*
cache
,
int
resize);
25
void
chooseln_cache_free2
(
struct
chooseln_cache
*
cache
);
26
27
static
inline
double
chooseln_get2(
struct
chooseln_cache
*
cache
,
int
n,
int
x)
28
{
29
assert(n < cache->size * 2);
30
assert(x <= cache->size);
31
if
(cache->
values
[n] && cache->
values
[n][x] >= 0)
return
cache->
values
[n][x];
32
if
(cache->
values
[n] == NULL)
33
{
34
int
i;
35
cache->
values
[n] = (
double
*)
memory_new
(cache->
size
+ 1,
sizeof
(
double
));
36
for
(i = 0; i <= cache->
size
; i++)
37
cache->
values
[n][i] = -1.0;
38
}
39
cache->
values
[n][x] =
chooseln
(n, x);
40
return
cache->
values
[n][x];
41
}
42
43
#endif
chooseln_cache::values
double ** values
Definition:
chooseln_cache.h:17
chooseln_cache::size
int size
Definition:
chooseln_cache.h:18
get_chooseln_cache_size2
int get_chooseln_cache_size2(struct chooseln_cache *cache)
Definition:
chooseln_cache.c:10
memory_new
void * memory_new(size_t count, size_t size)
Definition:
memalloc.c:4
chooseln_cache_resize2
void chooseln_cache_resize2(struct chooseln_cache *cache, int resize)
Definition:
chooseln_cache.c:36
cache
struct chooseln_cache cache
A cache of values of chooseln.
Definition:
birthdeath.c:32
chooseln_is_init2
int chooseln_is_init2(struct chooseln_cache *cache)
Definition:
chooseln_cache.c:5
chooseln
double chooseln(double n, double r)
Definition:
mathfunc.c:224
chooseln_cache
A cache of values of chooseln.
Definition:
chooseln_cache.h:16
chooseln_cache_init2
void chooseln_cache_init2(struct chooseln_cache *cache, int size)
Definition:
chooseln_cache.c:58
mathfunc.h
memalloc.h
chooseln_cache_free2
void chooseln_cache_free2(struct chooseln_cache *cache)
Definition:
chooseln_cache.c:70
libtree
chooseln_cache.h
Generated by
1.8.6