/[escript]/trunk/escript/src/DataArrayView.cpp
ViewVC logotype

Diff of /trunk/escript/src/DataArrayView.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 122 by jgs, Thu Jun 9 05:38:05 2005 UTC revision 126 by jgs, Fri Jul 22 03:53:08 2005 UTC
# Line 742  DataArrayView::matMult(const DataArrayVi Line 742  DataArrayView::matMult(const DataArrayVi
742        throw DataException(temp.str());        throw DataException(temp.str());
743      }      }
744    
745      if (left.getShape()[left.getRank()-1]!=right.getShape()[0]) {      if (left.getShape()[left.getRank()-1] != right.getShape()[0]) {
746        stringstream temp;        stringstream temp;
747        temp << "Error - (matMult) Dimension: " << left.getRank()        temp << "Error - (matMult) Dimension: " << left.getRank()
748         << ", size: " << left.getShape()[left.getRank()-1]         << ", size: " << left.getShape()[left.getRank()-1]
# Line 751  DataArrayView::matMult(const DataArrayVi Line 751  DataArrayView::matMult(const DataArrayVi
751        throw DataException(temp.str());        throw DataException(temp.str());
752      }      }
753    
754      int outputRank=left.getRank()+right.getRank()-2;      int outputRank = left.getRank()+right.getRank()-2;
755        
756      if (outputRank < 0) {      if (outputRank < 0) {
757        stringstream temp;        stringstream temp;
758        temp << "Error - (matMult) Left and right operands cannot be multiplied "        temp << "Error - (matMult) LHS and RHS cannot be multiplied "
759         << "as they have incompatable rank.";         << "as they have incompatable rank.";
760        throw DataException(temp.str());        throw DataException(temp.str());
761      }      }
# Line 768  DataArrayView::matMult(const DataArrayVi Line 768  DataArrayView::matMult(const DataArrayVi
768        throw DataException(temp.str());        throw DataException(temp.str());
769      }      }
770    
771      for (int i=0; i<(left.getRank()-1); ++i) {      for (int i=0; i<(left.getRank()-1); i++) {
772        if (left.getShape()[i]!=result.getShape()[i]) {        if (left.getShape()[i] != result.getShape()[i]) {
773      stringstream temp;      stringstream temp;
774      temp << "Error - (matMult) Dimension: " << i      temp << "Error - (matMult) Dimension: " << i
775           << " of LHS and output array don't match.";           << " of LHS and result array don't match.";
776      throw DataException(temp.str());      throw DataException(temp.str());
777        }        }
778      }      }
779    
780      for (int i=1; i<right.getRank(); ++i) {      for (int i=1; i<right.getRank(); i++) {
781        if (right.getShape()[i] != result.getShape()[i+left.getRank()-2]) {        if (right.getShape()[i] != result.getShape()[i+left.getRank()-2]) {
782      stringstream temp;      stringstream temp;
783      temp << "Error - (matMult) Dimension: " << i      temp << "Error - (matMult) Dimension: " << i
784           << ", size: " << right.getShape()[i]           << ", size: " << right.getShape()[i]
785           << " of RHS and dimension: " << i+left.getRank()-1           << " of RHS and dimension: " << i+left.getRank()-1
786           << ", size: " << result.getShape()[i+left.getRank()-1]           << ", size: " << result.getShape()[i+left.getRank()-1]
787           << " of output array don't match.";           << " of result array don't match.";
788      throw DataException(temp.str());      throw DataException(temp.str());
789        }        }
790      }      }

Legend:
Removed from v.122  
changed lines
  Added in v.126

  ViewVC Help
Powered by ViewVC 1.1.26