plCndProbTable
on
plProbTable
s
with variable frequency distribution data plProbTable
definition).
plCndProbTable
on
The construction of the variable sets and
and
the variable values shows as follow
plIntegerType Tx(1,N); plRealType TFrequency(0,1000); plArray Omega_s("x",Tx,1,2); plArray Omega_k("d",TFrequency,2,N,N); plValues values(Omega_s^Omega_k);
Note that is a
dimensional array
and that the number of elements (i.e. 9=3*3) is the order of
. The number of elements on
must be equal to the
cardinality
of
. This because the instantiation
requires of
values corresponding to the frequency distribution of
the
possible values of
.
The construction of the plCndProbTable
is executed by the
following code
plCndProbTable my_cnd_kernel(Omega_s,Omega_k);
Finally the values of used in the
function are
read as follow
int i,j; plFloat v; for(i=0;i<N;i++) for(j=0;j<N;j++) { cout<<"Give me the data "<<i<<","<<j<<": "; cin>>v; values[Omega_k(i,j)]= v; }
Lets make the observation that could be defined in many
ways. For instance,
plArray Omega_k("d",TFrequency,1,N*N);
remember that the unique requirement of is to
contain
variables. Again, this because a frequency value must be
assigned to each of the
possible values of
. A variable
on
represents then the frequency of a particular value
. Of course if we use the previous definition of
Omega_k
then we shall read the variable values as follows
int i,j; plFloat v; for(i=0;i<N*N;i++){ cout<<"Give me the data "<<i<<": "; cin>>v; values[Omega_k(i)]= v; }
values[Omega_k(0)]
corresponds then to the frequency of
x(0,0)
, values[Omega_k(0)]
to that of x(0,1)
and
so on. That is the values are organized by rows. For dimension higher
than two the same principle is applied.