Home > Mateda2.0 > otherfiles > NumconvertCard.m

# NumconvertCard

## PURPOSE

[valindex] = NumconvertCard(num,length,AccCard)

## SYNOPSIS

function [valindex] = NumconvertCard(num,length,AccCard)

## DESCRIPTION

     [valindex] = NumconvertCard(num,length,AccCard)
     NumconverCard:  Converts a vector of variables num, where the accumulative cardinality of each variable
                     is in AccCard, to the index valindex corresponding to the vector.
     INPUT:
     num: vector of values
     length: length of the vector
     AccCard: The product of cardinalities of previous  variables,
              where the first variable is  the first one to the left.
     OUTPUT:
     valindex: index of the vector in an ordering of all possible vectors

     Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- EvaluateGeneralFunction [val] = EvaluateGeneralFunction(vector):
- PartialEvaluateGeneralFunction [val] = PartialEvaluateGeneralFunction(vector):
- LearnFDAParameters [Tables] = LearnFDAParameters(Cliques,SelPop,NumbVar,Card)
- LearnMOAParameters [Tables] = LearnMOAParameters(Cliques,SelPop,NumbVar,Card)
- LearnMOAProb [Tables] = LearnMOAProb(Cliques,SelPop,NumbVar,N,Card)
- FindListCliqAccCard [ListCliqAccCard] = FindListCliqAccCard(totcliq,ListCliques,Card)
- Find_kMPEs [k_solutions,k_probvalues] = Find_kMPEs(bnet,k,Card)
- MNGibbsGenerateIndividual [NewIndividual] = MOAGenerateIndividual(OldIndividual,Cliques,Tables,Card,GibbSteps)
- MOAGenerateIndividual [NewIndividual] = MOAGenerateIndividual(OldIndividual,Cliques,Tables,Card,GibbSteps)
- SampleFDA [NewPop] = SampleFDA(NumbVar,model,Card,AuxPop,AuxFunVal,sampling_params)

## SOURCE CODE

    0001 function [valindex] = NumconvertCard(num,length,AccCard)
    0002 % [valindex] = NumconvertCard(num,length,AccCard)
    0003 % NumconverCard:  Converts a vector of variables num, where the accumulative cardinality of each variable
    0004 %                 is in AccCard, to the index valindex corresponding to the vector.
    0005 % INPUT:
    0006 % num: vector of values
    0007 % length: length of the vector
    0008 % AccCard: The product of cardinalities of previous  variables,
    0009 %          where the first variable is  the first one to the left.
    0010 % OUTPUT:
    0011 % valindex: index of the vector in an ordering of all possible vectors
    0012 %
    0013 % Last version 8/26/2008. Roberto Santana (roberto.santana@ehu.es)
    0014
    0015    valindex = num(length);
    0016      for i=1:length-1,
    0017       valindex =  valindex +  num(i)*AccCard(i);
    0018      end