Changeset 361 for cpp/frams/_demos


Ignore:
Timestamp:
04/18/15 17:31:31 (5 years ago)
Author:
Maciej Komosinski
Message:

Signed/unsigned int issues (r352) resolved differently - in most cases no (int)size() cast

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/simil_test.cpp

    r359 r361  
    3636    ...
    3737    <row_n>
    38 
    39     Last modified: 2015-04-16
    4038 */
    4139int main(int argc, char *argv[])
     
    160158    // create the empty array of similarities
    161159    aaSimil = new pDouble [pvGenos->size()];
    162     for (int k = 0; k < (int) pvGenos->size(); k++)
     160    for (unsigned int k = 0; k < pvGenos->size(); k++)
    163161    {
    164162        aaSimil[k] = new double [pvGenos->size()];
    165         for (int l = 0; l < (int) pvGenos->size(); l++)
     163                for (unsigned int l = 0; l < pvGenos->size(); l++)
    166164            aaSimil[k][l] = 0.0;
    167165    }
    168166
    169167    // compute and remember similarities
    170     int i, j;
    171     for (i = 0; i < (int) pvGenos->size(); i++)
    172     {
    173         for (j = 0; j < (int) pvGenos->size(); j++)
     168        for (unsigned int i = 0; i < pvGenos->size(); i++)
     169    {
     170                for (unsigned int j = 0; j < pvGenos->size(); j++)
    174171        {
    175172            dSimilarity = M.EvaluateDistance(pvGenos->operator[](i), pvGenos->operator[](j));
     
    183180        // print the number of genotypes and their names
    184181        printf("%li\n", pvGenos->size());
    185         int iGen;
    186         for (iGen = 0; iGen < (int) pvNames->size(); iGen++)
     182                for (unsigned int iGen = 0; iGen < pvNames->size(); iGen++)
    187183        {
    188184            printf("%s\n", pvNames->at(iGen));
    189185        }
    190     } // if (bPrintNames)
     186    }
    191187
    192188    // print out the matrix of similarities
    193     for (i = 0; i < (int) pvGenos->size(); i++)
    194     {
    195         for (j = 0; j < (int) pvGenos->size(); j++)
     189        for (unsigned int i = 0; i < pvGenos->size(); i++)
     190    {
     191                for (unsigned int j = 0; j < pvGenos->size(); j++)
    196192        {
    197193            printf("%.2lf\t", aaSimil[i][j]);
     
    201197
    202198    // delete vectors and arrays
    203     for (i = 0; i < (int) pvGenos->size(); i++)
     199        for (unsigned int i = 0; i < pvGenos->size(); i++)
    204200    {
    205201        delete pvGenos->operator[](i);
Note: See TracChangeset for help on using the changeset viewer.