Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Langford <jl@hunch.net>2014-01-25 22:44:55 +0400
committerJohn Langford <jl@hunch.net>2014-01-25 22:44:55 +0400
commit1a9eae25b5fc861af1f6714b3ad61822bcf4726f (patch)
treef5f6cc5b7da86c1eef7710428ba8e92f8670d8d8 /vowpalwabbit/sparse_dense.h
parent9fd03e09f186516b2cd80f13be74a3645de93d24 (diff)
minor tweaks
Diffstat (limited to 'vowpalwabbit/sparse_dense.h')
-rw-r--r--vowpalwabbit/sparse_dense.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/vowpalwabbit/sparse_dense.h b/vowpalwabbit/sparse_dense.h
index 38c1b691..b3009246 100644
--- a/vowpalwabbit/sparse_dense.h
+++ b/vowpalwabbit/sparse_dense.h
@@ -22,16 +22,16 @@ inline float trunc_weight(const float w, const float gravity){
return (gravity < fabsf(w)) ? w - sign(w) * gravity : 0.f;
}
-inline void vec_add(float& p, float fx, float& fw) {
+inline void vec_add(float& p, const float fx, float& fw) {
p += fw * fx;
}
-inline void vec_add_trunc(predict_data<float>& p, float fx, float& fw) {
+inline void vec_add_trunc(predict_data<float>& p, const float fx, float& fw) {
p.prediction += trunc_weight(fw, p.extra) * fx;
}
template <bool adaptive, size_t normalized_idx>
-inline void vec_add_rescale(float& p, float fx, float& fw) {
+inline void vec_add_rescale(float& p, const float fx, float& fw) {
weight* w = &fw;
float x_abs = fabs(fx);
if( x_abs > w[normalized_idx] ) {// new scale discovered
@@ -45,7 +45,7 @@ inline void vec_add_rescale(float& p, float fx, float& fw) {
}
template <bool adaptive, size_t normalized_idx>
-inline void vec_add_trunc_rescale(predict_data<float>& p, float fx, float& fw) {
+inline void vec_add_trunc_rescale(predict_data<float>& p, const float fx, float& fw) {
weight* w = &fw;
float x_abs = fabs(fx);
if( x_abs > w[normalized_idx] ) {
@@ -59,7 +59,7 @@ inline void vec_add_trunc_rescale(predict_data<float>& p, float fx, float& fw) {
}
template <bool adaptive, size_t normalized_idx>
-inline void vec_add_rescale_general(predict_data<float>& p, float fx, float& fw) {
+inline void vec_add_rescale_general(predict_data<float>& p, const float fx, float& fw) {
weight* w = &fw;
float x_abs = fabs(fx);
float power_t_norm = 1.f - (adaptive ? p.extra : 0.f);
@@ -79,7 +79,7 @@ struct gnp {
};
template <bool adaptive, size_t normalized_idx>
-inline void vec_add_trunc_rescale_general(predict_data<gnp>& p, float fx, float& fw) {
+inline void vec_add_trunc_rescale_general(predict_data<gnp>& p, const float fx, float& fw) {
weight* w = &fw;
float x_abs = fabs(fx);
float power_t_norm = 1.f - (adaptive ? p.extra.power_t : 0.f);