ADMB Documentation
-a65f1c97
Main Page
Function Reference
Classes
Source Code
Related Pages
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
linad99
multiindex.cpp
Go to the documentation of this file.
1
/*
2
* $Id$
3
*
4
* Author: David Fournier
5
* Copyright (c) 2008-2012 Regents of the University of California
6
*/
11
#include <
fvar.hpp
>
12
17
multi_index::multi_index
(
int
min
,
int
max
,
int
dim) :
18
mind(min),maxd(max),depth(min), index(1, dim)
19
{
20
index
=
min
;
21
}
22
void
multi_index::operator ++
(
void
)
23
{
24
int
imin=
index
.
indexmin
();
25
int
imax=
index
.
indexmax
();
26
index
(imin)++;
27
int
tmpdepth=1;
28
for
(
int
i=imin;i<=imax;i++)
29
{
30
if
(
index
(i)>
maxd
)
31
{
32
if
(i<imax)
33
{
34
index
(i+1)++;
35
}
36
index
(i)=
mind
;
37
tmpdepth=i+1;
38
}
39
else
40
{
41
break
;
42
}
43
}
44
if
(tmpdepth>
depth
)
45
depth
=tmpdepth;
46
}
47
int
multi_index::get_offset
(
void
)
48
{
49
int
imin=
index
.
indexmin
();
50
int
imax=
index
.
indexmax
();
51
int
offset=
index
(imin)-
mind
;
52
int
mx=
min
(
depth
,imax);
53
int
sz=
maxd
-
mind
+1;
54
for
(
int
i=imin+1;i<=mx;i++)
55
{
56
offset+=int(
pow
(
double
(sz),i-imin))*(
index
(i)-
mind
);
57
}
58
return
offset;
59
}
60
65
void
multi_index::initialize
(
void
)
66
{
67
index
=
mind
;
68
depth
=
mind
;
69
}
multi_index::mind
int mind
Definition:
fvar.hpp:9224
multi_index::depth
int depth
Definition:
fvar.hpp:9226
multi_index::get_offset
int get_offset(void)
Definition:
multiindex.cpp:47
min
#define min(a, b)
Definition:
cbivnorm.cpp:188
fvar.hpp
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
multi_index::operator++
void operator++(void)
Definition:
multiindex.cpp:22
ivector::indexmin
int indexmin() const
Definition:
ivector.h:99
ivector::indexmax
int indexmax() const
Definition:
ivector.h:104
multi_index::initialize
void initialize()
Description not yet available.
Definition:
multiindex.cpp:65
multi_index::maxd
int maxd
Definition:
fvar.hpp:9225
multi_index::index
ivector index
Definition:
fvar.hpp:9227
max
#define max(a, b)
Definition:
cbivnorm.cpp:189
multi_index::multi_index
multi_index(int min, int max, int dim)
Description not yet available.
Definition:
multiindex.cpp:17
pow
d3_array pow(const d3_array &m, int e)
Description not yet available.
Definition:
d3arr6.cpp:17
Generated on Wed Sep 7 2022 00:01:29 for ADMB Documentation by
1.8.5