Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
include
osl
eval
ml
weights.h
Go to the documentation of this file.
1
/* weights.h
2
*/
3
#ifndef OSL_EVAL_WEIGHTS_H
4
#define OSL_EVAL_WEIGHTS_H
5
6
#include "
osl/eval/ml/midgame.h
"
7
#include "
osl/stl/vector.h
"
8
#include <valarray>
9
#include <cassert>
10
11
namespace
osl
12
{
13
namespace
eval
14
{
15
namespace
ml
16
{
17
struct
Weights
18
{
19
protected
:
20
std::valarray<signed short>
values
;
21
size_t
dim
;
22
public
:
23
explicit
Weights
(
size_t
dim
=0);
24
virtual
~Weights
();
25
26
void
resetDimension
(
size_t
new_dim);
27
int
value
(
size_t
index)
const
{ assert(index <
dim
);
return
values
[index]; }
28
void
setRandom
();
29
size_t
dimension
()
const
{
return
dim
; }
30
31
void
setValue
(
size_t
index,
int
value
)
32
{
33
assert(index <
dim
);
34
values
[index] =
value
;
35
assert(
values
[index] == value);
36
}
37
};
38
39
class
MultiWeights
40
{
41
protected
:
42
std::vector<MultiInt>
values
;
43
size_t
one_dim
;
44
public
:
45
explicit
MultiWeights
(
size_t
one_dim
=0);
46
virtual
~MultiWeights
();
47
48
void
resetDimension
(
size_t
one_dim
);
49
const
MultiInt
&
value
(
size_t
index)
const
{ assert(index <
one_dim
);
return
values
[index]; }
50
void
setRandom
();
51
size_t
oneDimension
()
const
{
return
one_dim
; }
52
void
setValue
(
size_t
index,
MultiInt
value
)
53
{
54
assert(index <
one_dim
);
55
values
[index] =
value
;
56
}
57
};
58
}
59
}
60
}
61
62
#endif
/* OSL_EVAL_WEIGHTS_H */
63
// ;;; Local Variables:
64
// ;;; mode:c++
65
// ;;; c-basic-offset:2
66
// ;;; End:
Generated on Sun Jul 21 2013 13:37:27 by
1.8.4