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

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

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

revision 575 by jgs, Tue Feb 28 06:53:17 2006 UTC revision 576 by gross, Fri Mar 3 08:28:42 2006 UTC
# Line 1189  Data::transpose(int axis) const Line 1189  Data::transpose(int axis) const
1189  #if defined DOPROF  #if defined DOPROF
1190    profData->reduction2++;    profData->reduction2++;
1191  #endif  #endif
1192    
1193    // not implemented    // not implemented
1194    throw DataException("Error - Data::transpose not implemented yet.");    throw DataException("Error - Data::transpose not implemented yet.");
1195    return Data();    return Data();
1196  }  }
1197    
1198    Data
1199    Data::eigenvalues() const
1200    {
1201         #if defined DOPROF
1202            profData->unary++;
1203         #endif
1204         // check input
1205         DataArrayView::ShapeType s=getDataPointShape();
1206         if (getDataPointRank()!=2)
1207            throw DataException("Error - Data::eigenvalues can only be calculated for rank 2 object.");
1208         if(s[0] != s[1])
1209            throw DataException("Error - Data::eigenvalues can only be calculated for object with equal first and second dimension.");
1210         // create return
1211         DataArrayView::ShapeType ev_shape(1,s[0]);
1212         Data ev(0.,ev_shape,getFunctionSpace());
1213         ev.typeMatchRight(*this);
1214         m_data->eigenvalues(ev.m_data.get());
1215         return ev;
1216    }
1217    
1218    const boost::python::tuple
1219    Data::eigenvalues_and_eigenvectors(const double tol) const
1220    {
1221         #if defined DOPROF
1222            profData->unary++;
1223         #endif
1224         DataArrayView::ShapeType s=getDataPointShape();
1225         if (getDataPointRank()!=2)
1226            throw DataException("Error - Data::eigenvalues and eigenvectors can only be calculated for rank 2 object.");
1227         if(s[0] != s[1])
1228            throw DataException("Error - Data::eigenvalues and eigenvectors can only be calculated for object with equal first and second dimension.");
1229         // create return
1230         DataArrayView::ShapeType ev_shape(1,s[0]);
1231         Data ev(0.,ev_shape,getFunctionSpace());
1232         ev.typeMatchRight(*this);
1233         DataArrayView::ShapeType V_shape(2,s[0]);
1234         Data V(0.,V_shape,getFunctionSpace());
1235         V.typeMatchRight(*this);
1236         m_data->eigenvalues_and_eigenvectors(ev.m_data.get(),V.m_data.get(),tol);
1237         return make_tuple(boost::python::object(ev),boost::python::object(V));
1238    }
1239    
1240  const boost::python::tuple  const boost::python::tuple
1241  Data::mindp() const  Data::mindp() const
1242  {  {

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

  ViewVC Help
Powered by ViewVC 1.1.26