/[escript]/branches/arrayview_from_1695_trunk/escript/src/DataArrayView.cpp
ViewVC logotype

Diff of /branches/arrayview_from_1695_trunk/escript/src/DataArrayView.cpp

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

revision 480 by jgs, Wed Feb 1 05:15:12 2006 UTC revision 576 by gross, Fri Mar 3 08:28:42 2006 UTC
# Line 728  DataArrayView::shapeToString(const DataA Line 728  DataArrayView::shapeToString(const DataA
728      return temp.str();      return temp.str();
729  }  }
730    
731    void
732    DataArrayView::eigenvalues(const DataArrayView& in,
733                               DataArrayView& ev)
734    {
735       EsysAssert(!in.isEmpty(),
736                   "Error - in view is empty.");
737       EsysAssert(!ev.isEmpty(),
738                   "Error - ev view is empty.");
739       EsysAssert(in.getRank()==2,
740                   "Error - in has not rank 2.");
741       EsysAssert(in.getShape()[0]==in.getShape()[1],
742                   "Error - in is not square");
743       EsysAssert(ev.getRank()==1,
744                   "Error - ev has not rank 1.");
745       EsysAssert(ev.getShape()[0]==in.getShape()[0],
746                   "Error - ev is too short");
747       EsysAssert(0<ev.getShape()[0] && ev.getShape()[0]<4,
748                   "Error - dimension is restricted to 3.");
749       double ev0,ev1,ev2;
750       int s=in.getShape()[0];
751       if (s==1) {
752          eigenvalues1(in(0,0),&ev0);
753          ev(0)=ev0;
754    
755       } else  if (s==2) {
756          eigenvalues2(in(0,0),(in(0,1)+in(1,0))/2.,in(1,1),
757                       &ev0,&ev1);
758          ev(0)=ev0;
759          ev(1)=ev1;
760    
761       } else  if (s==3) {
762          eigenvalues3(in(0,0),(in(0,1)+in(1,0))/2.,(in(0,2)+in(2,0))/2.,in(1,1),(in(2,1)+in(1,2))/2.,in(2,2),
763                     &ev0,&ev1,&ev2);
764          ev(0)=ev0;
765          ev(1)=ev1;
766          ev(2)=ev2;
767    
768       }
769    }
770    
771  void  void
772  DataArrayView::matMult(const DataArrayView& left,  DataArrayView::matMult(const DataArrayView& left,
773                         const DataArrayView& right,                         const DataArrayView& right,

Legend:
Removed from v.480  
changed lines
  Added in v.576

  ViewVC Help
Powered by ViewVC 1.1.26