Changeset 7f11e05 in tol


Ignore:
Timestamp:
Jan 9, 2012, 10:12:53 AM (15 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
acc9f1a
Parents:
612d116
Message:

Fixed bug in ConcatColumns and ConcatRows with empty matrices

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@3998 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/btol/matrix_type/matgra.cpp

    r612d116 r7f11e05  
    31933193  BInt  i, j, k=0, l;
    31943194  BInt  numCol = 0;
    3195   BInt  numRow = Mat(Arg(1)).Rows();
     3195  BInt  numRow = 0;
    31963196  BInt  numMat = NumArgs();
    31973197  for(i=1; i<=numMat; i++)
    … …  
    31993199    BMat& Mi = Mat(Arg(i));
    32003200    numCol+=Mi.Columns();
    3201     if(!numRow) { numRow=Mi.Rows(); }
     3201    if(numRow<Mi.Rows()) { numRow = Mi.Rows(); }
     3202  }
     3203  for(i=1; i<=numMat; i++)
     3204  {
     3205    BMat& Mi = Mat(Arg(i));
    32023206    if(Mi.Columns() && (Mi.Rows()!=numRow))
    32033207    {
    … …  
    32163220  {
    32173221    DMat& Mi = dMat(Arg(i));
    3218     for(j=0; j < Mi.Columns(); j++, k++)
    3219     {
    3220       for(l=0; l < numRow; l++)
     3222    if(Mi.Columns() && (Mi.Rows()==numRow))
     3223    {
     3224      for(j=0; j < Mi.Columns(); j++, k++)
    32213225      {
    3222         b2dMat(contens_)(l,k)=Mi(l,j);
     3226        for(l=0; l < numRow; l++)
     3227        {
     3228          b2dMat(contens_)(l,k)=Mi(l,j);
     3229        }
    32233230      }
    32243231    }
    … …  
    32493256{
    32503257  BInt  i, j, k=0, l;
    3251   BInt  numCol = Mat(Arg(1)).Columns();
     3258  BInt  numCol = 0;
    32523259  BInt  numRow = 0;
    32533260  BInt  numMat = NumArgs();
    … …  
    32563263    BMat& Mi = Mat(Arg(i));
    32573264    numRow+=Mi.Rows();
    3258     if(!numCol) { numRow=Mi.Columns(); }
     3265    if(numCol<Mi.Columns()) { numCol = Mi.Columns(); }
     3266  }
     3267  for(i=1; i<=numMat; i++)
     3268  {
     3269    BMat& Mi = Mat(Arg(i));
    32593270    if(Mi.Rows() && (Mi.Columns()!=numCol))
    32603271    {
    … …  
    32733284  {
    32743285    DMat& Mi = dMat(Arg(i));
    3275     for(j=0; j < Mi.Rows(); j++, k++)
    3276     {
    3277       for(l=0; l < numCol; l++)
     3286    if(Mi.Rows() && (Mi.Columns()==numCol))
     3287    {
     3288      for(j=0; j < Mi.Rows(); j++, k++)
    32783289      {
    3279        b2dMat(contens_)(k,l)=Mi(j,l);
    3280       }
     3290        for(l=0; l < numCol; l++)
     3291        {
     3292          b2dMat(contens_)(k,l)=Mi(j,l);
     3293        }
     3294      }
    32813295    }
    32823296  }
Note: See TracChangeset for help on using the changeset viewer.