X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Fcategoricals.c;h=d0762831a9b22e8c2766fbbd0010105be5601136;hb=15ad18b01e1d7519be521c31b2a02dc123a1ff69;hp=19b6e3f11907dec4f8e92a43d38d1c8dc7c7182f;hpb=d06112af3e59338577515f98ec929454d608db71;p=pspp-builds.git diff --git a/src/math/categoricals.c b/src/math/categoricals.c index 19b6e3f1..d0762831 100644 --- a/src/math/categoricals.c +++ b/src/math/categoricals.c @@ -317,6 +317,27 @@ categoricals_get_value_by_subscript (const struct categoricals *cat, int subscri return &vn->value; } + +double +categoricals_get_weight_by_subscript (const struct categoricals *cat, int subscript) +{ + int vindex = cat->reverse_variable_map[subscript]; + const struct var_params *vp = &cat->vp[vindex]; + + return vp->cc; +} + +double +categoricals_get_sum_by_subscript (const struct categoricals *cat, int subscript) +{ + int vindex = cat->reverse_variable_map[subscript]; + const struct var_params *vp = &cat->vp[vindex]; + + const struct value_node *vn = vp->reverse_value_map [subscript - vp->base_subscript]; + return vn->cc; +} + + /* Returns unity if the value in case C at SUBSCRIPT is equal to the category for that subscript */ double