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

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

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

revision 2548 by jfenwick, Mon Jul 20 06:20:06 2009 UTC revision 2742 by jfenwick, Thu Nov 12 06:03:37 2009 UTC
# Line 744  DataTagged::eigenvalues_and_eigenvectors Line 744  DataTagged::eigenvalues_and_eigenvectors
744  }  }
745    
746  void  void
747    DataTagged::matrixInverse(DataAbstract* out) const
748    {
749      DataTagged* temp=dynamic_cast<DataTagged*>(out);
750      if (temp==0)
751      {
752        throw DataException("Error - DataTagged::matrixInverse: casting to DataTagged failed (propably a programming error).");
753      }
754      if (getRank()!=2)
755      {
756        throw DataException("Error - DataExpanded::matrixInverse: input must be rank 2.");
757      }
758      const DataTagged::DataMapType& thisLookup=getTagLookup();
759      DataTagged::DataMapType::const_iterator i;
760      DataTagged::DataMapType::const_iterator thisLookupEnd=thisLookup.end();
761      ValueType& outVec=temp->getVectorRW();
762      const ShapeType& outShape=temp->getShape();
763      LapackInverseHelper h(getShape()[0]);
764      int err=0;
765      for (i=thisLookup.begin();i!=thisLookupEnd;i++) {
766          temp->addTag(i->first);
767          DataTypes::ValueType::size_type inoffset=getOffsetForTag(i->first);
768          DataTypes::ValueType::size_type outoffset=temp->getOffsetForTag(i->first);
769    
770          err=DataMaths::matrix_inverse(m_data, getShape(), inoffset, outVec, outShape, outoffset, 1, h);
771          if (!err) break;
772      }
773      if (!err)
774      {
775          DataMaths::matrix_inverse(m_data, getShape(), getDefaultOffset(), outVec, outShape, temp->getDefaultOffset(), 1, h);
776      }
777      if (err)
778      {
779         DataMaths::matrixInverseError(err);    // throws exceptions
780      }
781    }
782    
783    void
784  DataTagged::setToZero(){  DataTagged::setToZero(){
785      CHECK_FOR_EX_WRITE      CHECK_FOR_EX_WRITE
786      DataTypes::ValueType::size_type n=m_data.size();      DataTypes::ValueType::size_type n=m_data.size();

Legend:
Removed from v.2548  
changed lines
  Added in v.2742

  ViewVC Help
Powered by ViewVC 1.1.26