Table of Contents

NAME

QccVectorGetSymbolProbs - calculate probabilities of a list of symbols

SYNOPSIS

#include "libQccPack.h"

int QccVectorGetSymbolProbs(const int *symbol_list, int symbol_list_length, QccVector probs, int num_symbols);

DESCRIPTION

QccVectorGetSymbolProbs() accepts a list of symbols, counts the number of times each symbol occurs in the list, and returns a list of probabilities based on the observed occurrences of the symbol values in the list.

More specifically, symbol_list is the list of symbol values, symbol_list_length is the length of the symbol list, probs is the list of probabilities returned, and num_symbols is the length of the probability list (one probability for each possible symbol). Each symbol in symbol_list must be an int in the range of 0 to num_symbols - 1. Suppose that symbol is a symbol in the range 0 to num_symbols - 1; QccVectorGetSymbolProbs() counts the number of occurrences of symbol in symbol_list. The probability of symbol, which is returned in probs[symbol] is calculated as count(symbol) / symbol_list_length.

The returned list of probabilities, probs, is a valid probability density it that in sums to 1.0.

SEE ALSO

QccPack(3)

AUTHOR

Copyright (C) 1997-2021 James E. Fowler


Table of Contents



Get QccPack at SourceForge.net. Fast, secure and Free Open Source software downloads