/[escript]/branches/trilinos_from_5897/escriptcore/src/DataMaths.h
ViewVC logotype

Diff of /branches/trilinos_from_5897/escriptcore/src/DataMaths.h

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

revision 5962 by caltinay, Fri Feb 5 03:37:49 2016 UTC revision 5963 by caltinay, Mon Feb 22 06:59:27 2016 UTC
# Line 62  Note that vector in this context refers Line 62  Note that vector in this context refers
62    */    */
63    template <class UnaryFunction>    template <class UnaryFunction>
64    void    void
65    unaryOp(DataTypes::ValueType& data, const DataTypes::ShapeType& shape,    unaryOp(DataTypes::RealVectorType& data, const DataTypes::ShapeType& shape,
66            DataTypes::ValueType::size_type offset,            DataTypes::RealVectorType::size_type offset,
67            UnaryFunction operation);            UnaryFunction operation);
68    
69    /**    /**
# Line 82  Note that vector in this context refers Line 82  Note that vector in this context refers
82    */    */
83    template <class BinaryFunction>    template <class BinaryFunction>
84    void    void
85    binaryOp(DataTypes::ValueType& left,    binaryOp(DataTypes::RealVectorType& left,
86         const DataTypes::ShapeType& leftShape,         const DataTypes::ShapeType& leftShape,
87             DataTypes::ValueType::size_type leftOffset,             DataTypes::RealVectorType::size_type leftOffset,
88             const DataTypes::ValueType& right,             const DataTypes::RealVectorType& right,
89             const DataTypes::ShapeType& rightShape,             const DataTypes::ShapeType& rightShape,
90             DataTypes::ValueType::size_type rightOffset,             DataTypes::RealVectorType::size_type rightOffset,
91             BinaryFunction operation);             BinaryFunction operation);
92    
93    /**    /**
# Line 108  Note that vector in this context refers Line 108  Note that vector in this context refers
108    */    */
109    template <class BinaryFunction>    template <class BinaryFunction>
110    void    void
111    binaryOp(DataTypes::ValueType& left,    binaryOp(DataTypes::RealVectorType& left,
112             const DataTypes::ShapeType& shape,             const DataTypes::ShapeType& shape,
113         DataTypes::ValueType::size_type offset,         DataTypes::RealVectorType::size_type offset,
114             double right,             double right,
115             BinaryFunction operation);             BinaryFunction operation);
116    
117    // ------------------------
118      
119      /**
120         \brief
121         Perform the binary operation on the data points specified by the given
122         offsets in the "left" and "right" vectors. Applies the specified operation
123         to corresponding values in both data points. Operation must be a pointer
124         to a function.
125    
126         Called by escript::binaryOp.
127         \param left,right - vectors containing the datapoints
128         \param leftShape,rightShape - shapes of datapoints in the vectors
129         \param leftOffset,rightOffset - beginnings of datapoints in the vectors
130         \param operation - Input -
131                      Operation to apply. Must be a pointer to a function.
132      */
133      template <class LVEC, class RVEC>
134      void
135      binaryOpVector(LVEC& left,
136           const DataTypes::ShapeType& leftShape,
137               typename LVEC::size_type leftOffset,
138               const RVEC& right,
139               const DataTypes::ShapeType& rightShape,
140               typename RVEC::size_type rightOffset,
141               escript::ESFunction operation);
142    
143      /**
144         \brief
145         Perform the binary operation on the data point specified by the given
146         offset in the vector using the scalar value "right". Applies the specified
147         operation to values in the data point. Operation must be a pointer
148         to a function.
149    
150         Called by escript::binaryOp.
151    
152         \param left - vector containing the datapoints
153         \param shape - shape of datapoint in the vector
154         \param offset - beginning of datapoint in the vector
155         \param right - scalar value for the right hand side of the operation
156         \param operation - Input -
157                      Operation to apply. Must be a pointer to a function.
158      */
159      template <class LVEC, class SCALAR>
160      void
161      binaryOpVector(LVEC& left,
162               const DataTypes::ShapeType& shape,
163           typename LVEC::size_type offset,
164               SCALAR right,
165               escript::ESFunction operation);
166      
167    // ------------------  
168      
169    
170    /**    /**
171       \brief       \brief
172       Perform the given data point reduction operation on the data point       Perform the given data point reduction operation on the data point
# Line 132  Note that vector in this context refers Line 185  Note that vector in this context refers
185    */    */
186    template <class BinaryFunction>    template <class BinaryFunction>
187    double    double
188    reductionOp(const DataTypes::ValueType& left,    reductionOp(const DataTypes::RealVectorType& left,
189            const DataTypes::ShapeType& shape,            const DataTypes::ShapeType& shape,
190            DataTypes::ValueType::size_type offset,            DataTypes::RealVectorType::size_type offset,
191                BinaryFunction operation,                BinaryFunction operation,
192                double initial_value);                double initial_value);
193    
# Line 154  Note that vector in this context refers Line 207  Note that vector in this context refers
207    */    */
208    ESCRIPT_DLL_API    ESCRIPT_DLL_API
209    void    void
210    matMult(const DataTypes::ValueType& left,    matMult(const DataTypes::RealVectorType& left,
211        const DataTypes::ShapeType& leftShape,        const DataTypes::ShapeType& leftShape,
212        DataTypes::ValueType::size_type leftOffset,        DataTypes::RealVectorType::size_type leftOffset,
213            const DataTypes::ValueType& right,            const DataTypes::RealVectorType& right,
214        const DataTypes::ShapeType& rightShape,        const DataTypes::ShapeType& rightShape,
215        DataTypes::ValueType::size_type rightOffset,        DataTypes::RealVectorType::size_type rightOffset,
216            DataTypes::ValueType& result,            DataTypes::RealVectorType& result,
217        const DataTypes::ShapeType& resultShape);        const DataTypes::ShapeType& resultShape);
218  // Hmmmm why is there no offset for the result??  // Hmmmm why is there no offset for the result??
219    
# Line 194  Note that vector in this context refers Line 247  Note that vector in this context refers
247    ESCRIPT_DLL_API    ESCRIPT_DLL_API
248    inline    inline
249    void    void
250    symmetric(const DataTypes::ValueType& in,    symmetric(const DataTypes::RealVectorType& in,
251          const DataTypes::ShapeType& inShape,          const DataTypes::ShapeType& inShape,
252              DataTypes::ValueType::size_type inOffset,              DataTypes::RealVectorType::size_type inOffset,
253              DataTypes::ValueType& ev,              DataTypes::RealVectorType& ev,
254          const DataTypes::ShapeType& evShape,          const DataTypes::ShapeType& evShape,
255              DataTypes::ValueType::size_type evOffset)              DataTypes::RealVectorType::size_type evOffset)
256    {    {
257     if (DataTypes::getRank(inShape) == 2) {     if (DataTypes::getRank(inShape) == 2) {
258       int i0, i1;       int i0, i1;
# Line 243  Note that vector in this context refers Line 296  Note that vector in this context refers
296    ESCRIPT_DLL_API    ESCRIPT_DLL_API
297    inline    inline
298    void    void
299    nonsymmetric(const DataTypes::ValueType& in,    nonsymmetric(const DataTypes::RealVectorType& in,
300             const DataTypes::ShapeType& inShape,             const DataTypes::ShapeType& inShape,
301                 DataTypes::ValueType::size_type inOffset,                 DataTypes::RealVectorType::size_type inOffset,
302                 DataTypes::ValueType& ev,                 DataTypes::RealVectorType& ev,
303             const DataTypes::ShapeType& evShape,             const DataTypes::ShapeType& evShape,
304                 DataTypes::ValueType::size_type evOffset)                 DataTypes::RealVectorType::size_type evOffset)
305    {    {
306     if (DataTypes::getRank(inShape) == 2) {     if (DataTypes::getRank(inShape) == 2) {
307       int i0, i1;       int i0, i1;
# Line 292  Note that vector in this context refers Line 345  Note that vector in this context refers
345    */    */
346    inline    inline
347    void    void
348    trace(const DataTypes::ValueType& in,    trace(const DataTypes::RealVectorType& in,
349          const DataTypes::ShapeType& inShape,          const DataTypes::ShapeType& inShape,
350              DataTypes::ValueType::size_type inOffset,              DataTypes::RealVectorType::size_type inOffset,
351              DataTypes::ValueType& ev,              DataTypes::RealVectorType& ev,
352          const DataTypes::ShapeType& evShape,          const DataTypes::ShapeType& evShape,
353              DataTypes::ValueType::size_type evOffset,              DataTypes::RealVectorType::size_type evOffset,
354          int axis_offset)          int axis_offset)
355    {    {
356     for (int j=0;j<DataTypes::noValues(evShape);++j)     for (int j=0;j<DataTypes::noValues(evShape);++j)
# Line 391  Note that vector in this context refers Line 444  Note that vector in this context refers
444    ESCRIPT_DLL_API    ESCRIPT_DLL_API
445    inline    inline
446    void    void
447    transpose(const DataTypes::ValueType& in,    transpose(const DataTypes::RealVectorType& in,
448          const DataTypes::ShapeType& inShape,          const DataTypes::ShapeType& inShape,
449              DataTypes::ValueType::size_type inOffset,              DataTypes::RealVectorType::size_type inOffset,
450              DataTypes::ValueType& ev,              DataTypes::RealVectorType& ev,
451              const DataTypes::ShapeType& evShape,              const DataTypes::ShapeType& evShape,
452              DataTypes::ValueType::size_type evOffset,              DataTypes::RealVectorType::size_type evOffset,
453          int axis_offset)          int axis_offset)
454    {    {
455     int inRank=DataTypes::getRank(inShape);     int inRank=DataTypes::getRank(inShape);
# Line 535  Note that vector in this context refers Line 588  Note that vector in this context refers
588    ESCRIPT_DLL_API    ESCRIPT_DLL_API
589    inline    inline
590    void    void
591    swapaxes(const DataTypes::ValueType& in,    swapaxes(const DataTypes::RealVectorType& in,
592         const DataTypes::ShapeType& inShape,         const DataTypes::ShapeType& inShape,
593             DataTypes::ValueType::size_type inOffset,             DataTypes::RealVectorType::size_type inOffset,
594             DataTypes::ValueType& ev,             DataTypes::RealVectorType& ev,
595         const DataTypes::ShapeType& evShape,         const DataTypes::ShapeType& evShape,
596             DataTypes::ValueType::size_type evOffset,             DataTypes::RealVectorType::size_type evOffset,
597             int axis0,             int axis0,
598         int axis1)         int axis1)
599    {    {
# Line 686  Note that vector in this context refers Line 739  Note that vector in this context refers
739    ESCRIPT_DLL_API    ESCRIPT_DLL_API
740    inline    inline
741    void    void
742    eigenvalues(const DataTypes::ValueType& in,    eigenvalues(const DataTypes::RealVectorType& in,
743            const DataTypes::ShapeType& inShape,            const DataTypes::ShapeType& inShape,
744                DataTypes::ValueType::size_type inOffset,                DataTypes::RealVectorType::size_type inOffset,
745                DataTypes::ValueType& ev,                DataTypes::RealVectorType& ev,
746            const DataTypes::ShapeType& evShape,            const DataTypes::ShapeType& evShape,
747                DataTypes::ValueType::size_type evOffset)                DataTypes::RealVectorType::size_type evOffset)
748    {    {
749     double in00,in10,in20,in01,in11,in21,in02,in12,in22;     double in00,in10,in20,in01,in11,in21,in02,in12,in22;
750     double ev0,ev1,ev2;     double ev0,ev1,ev2;
# Line 747  Note that vector in this context refers Line 800  Note that vector in this context refers
800    ESCRIPT_DLL_API    ESCRIPT_DLL_API
801    inline    inline
802    void    void
803    eigenvalues_and_eigenvectors(const DataTypes::ValueType& in, const DataTypes::ShapeType& inShape,    eigenvalues_and_eigenvectors(const DataTypes::RealVectorType& in, const DataTypes::ShapeType& inShape,
804                                 DataTypes::ValueType::size_type inOffset,                                 DataTypes::RealVectorType::size_type inOffset,
805                                 DataTypes::ValueType& ev, const DataTypes::ShapeType& evShape,                                 DataTypes::RealVectorType& ev, const DataTypes::ShapeType& evShape,
806                                 DataTypes::ValueType::size_type evOffset,                                 DataTypes::RealVectorType::size_type evOffset,
807                                 DataTypes::ValueType& V, const DataTypes::ShapeType& VShape,                                 DataTypes::RealVectorType& V, const DataTypes::ShapeType& VShape,
808                                 DataTypes::ValueType::size_type VOffset,                                 DataTypes::RealVectorType::size_type VOffset,
809                                 const double tol=1.e-13)                                 const double tol=1.e-13)
810    {    {
811     double in00,in10,in20,in01,in11,in21,in02,in12,in22;     double in00,in10,in20,in01,in11,in21,in02,in12,in22;
# Line 811  Note that vector in this context refers Line 864  Note that vector in this context refers
864     Inline function definitions.     Inline function definitions.
865  */  */
866    
867    template <class VEC>
868  inline  inline
869  bool  bool
870  checkOffset(const DataTypes::ValueType& data,  checkOffset(const VEC& data,
871          const DataTypes::ShapeType& shape,          const DataTypes::ShapeType& shape,
872          DataTypes::ValueType::size_type offset)          typename VEC::size_type offset)
873  {  {
874      return (data.size() >= (offset+DataTypes::noValues(shape)));      return (data.size() >= (offset+DataTypes::noValues(shape)));
875  }  }
# Line 823  checkOffset(const DataTypes::ValueType& Line 877  checkOffset(const DataTypes::ValueType&
877  template <class UnaryFunction>  template <class UnaryFunction>
878  inline  inline
879  void  void
880  unaryOp(DataTypes::ValueType& data, const DataTypes::ShapeType& shape,  unaryOp(DataTypes::RealVectorType& data, const DataTypes::ShapeType& shape,
881            DataTypes::ValueType::size_type offset,            DataTypes::RealVectorType::size_type offset,
882            UnaryFunction operation)            UnaryFunction operation)
883  {  {
884    EsysAssert((data.size()>0)&&checkOffset(data,shape,offset),    EsysAssert((data.size()>0)&&checkOffset(data,shape,offset),
885                 "Error - Couldn't perform unaryOp due to insufficient storage.");                 "Error - Couldn't perform unaryOp due to insufficient storage.");
886    DataTypes::ValueType::size_type nVals=DataTypes::noValues(shape);    DataTypes::RealVectorType::size_type nVals=DataTypes::noValues(shape);
887    for (DataTypes::ValueType::size_type i=0;i<nVals;i++) {    for (DataTypes::RealVectorType::size_type i=0;i<nVals;i++) {
888      data[offset+i]=operation(data[offset+i]);      data[offset+i]=operation(data[offset+i]);
889    }    }
890  }  }
# Line 839  unaryOp(DataTypes::ValueType& data, cons Line 893  unaryOp(DataTypes::ValueType& data, cons
893  template <class BinaryFunction>  template <class BinaryFunction>
894  inline  inline
895  void  void
896  binaryOp(DataTypes::ValueType& left,  binaryOp(DataTypes::RealVectorType& left,
897              const DataTypes::ShapeType& leftShape,              const DataTypes::ShapeType& leftShape,
898              DataTypes::ValueType::size_type leftOffset,              DataTypes::RealVectorType::size_type leftOffset,
899                          const DataTypes::ValueType& right,                          const DataTypes::RealVectorType& right,
900              const DataTypes::ShapeType& rightShape,              const DataTypes::ShapeType& rightShape,
901                          DataTypes::ValueType::size_type rightOffset,                          DataTypes::RealVectorType::size_type rightOffset,
902                          BinaryFunction operation)                          BinaryFunction operation)
903  {  {
904    EsysAssert(leftShape==rightShape,    EsysAssert(leftShape==rightShape,
# Line 853  binaryOp(DataTypes::ValueType& left, Line 907  binaryOp(DataTypes::ValueType& left,
907               "Error - Couldn't perform binaryOp due to insufficient storage in left object.");               "Error - Couldn't perform binaryOp due to insufficient storage in left object.");
908    EsysAssert(((right.size()>0)&&checkOffset(right,rightShape,rightOffset)),    EsysAssert(((right.size()>0)&&checkOffset(right,rightShape,rightOffset)),
909               "Error - Couldn't perform binaryOp due to insufficient storage in right object.");               "Error - Couldn't perform binaryOp due to insufficient storage in right object.");
910    for (DataTypes::ValueType::size_type i=0;i<DataTypes::noValues(leftShape);i++) {    for (DataTypes::RealVectorType::size_type i=0;i<DataTypes::noValues(leftShape);i++) {
911      left[leftOffset+i]=operation(left[leftOffset+i],right[rightOffset+i]);      left[leftOffset+i]=operation(left[leftOffset+i],right[rightOffset+i]);
912    }    }
913  }  }
# Line 861  binaryOp(DataTypes::ValueType& left, Line 915  binaryOp(DataTypes::ValueType& left,
915  template <class BinaryFunction>  template <class BinaryFunction>
916  inline  inline
917  void  void
918  binaryOp(DataTypes::ValueType& left,  binaryOp(DataTypes::RealVectorType& left,
919              const DataTypes::ShapeType& leftShape,              const DataTypes::ShapeType& leftShape,
920              DataTypes::ValueType::size_type offset,              DataTypes::RealVectorType::size_type offset,
921                          double right,                          double right,
922                          BinaryFunction operation)                          BinaryFunction operation)
923  {  {
924    EsysAssert(((left.size()>0)&&checkOffset(left,leftShape,offset)),    EsysAssert(((left.size()>0)&&checkOffset(left,leftShape,offset)),
925               "Error - Couldn't perform binaryOp due to insufficient storage in left object.");               "Error - Couldn't perform binaryOp due to insufficient storage in left object.");
926    for (DataTypes::ValueType::size_type i=0;i<DataTypes::noValues(leftShape);i++) {    for (DataTypes::RealVectorType::size_type i=0;i<DataTypes::noValues(leftShape);i++) {
927        left[offset+i]=operation(left[offset+i],right);
928      }
929    }
930    
931    
932    // -------------------
933    
934    
935    
936    template <class LVEC, class RVEC, class BinaryFunction>
937    inline
938    void
939    binaryOpVectorHelper(LVEC& left,
940                const DataTypes::ShapeType& leftShape,
941                typename LVEC::size_type leftOffset,
942                            const RVEC& right,
943                const DataTypes::ShapeType& rightShape,
944                            typename RVEC::size_type rightOffset,
945                            BinaryFunction operation)
946    {
947      for (DataTypes::RealVectorType::size_type i=0;i<DataTypes::noValues(leftShape);i++) {
948        left[leftOffset+i]=operation(left[leftOffset+i],right[rightOffset+i]);
949      }
950    }
951    
952    
953    
954    template <class LVEC, class RVEC>
955    inline
956    void
957    binaryOpVector(LVEC& left,
958                const DataTypes::ShapeType& leftShape,
959                typename LVEC::size_type leftOffset,
960                            const RVEC& right,
961                const DataTypes::ShapeType& rightShape,
962                            typename RVEC::size_type rightOffset,
963                            escript::ESFunction operation)
964    {
965      typedef typename LVEC::ElementType ltype;
966      typedef typename RVEC::ElementType rtype;
967      EsysAssert(leftShape==rightShape,
968             "Error - Couldn't perform binaryOp due to shape mismatch,");
969      EsysAssert(((left.size()>0)&&checkOffset(left,leftShape, leftOffset)),
970                 "Error - Couldn't perform binaryOp due to insufficient storage in left object.");
971      EsysAssert(((right.size()>0)&&checkOffset(right,rightShape,rightOffset)),
972                 "Error - Couldn't perform binaryOp due to insufficient storage in right object.");
973      switch (operation)
974      {
975        case POWF:binaryOpVectorHelper(left, leftShape, leftOffset, right, rightShape, rightOffset, pow_func<ltype,rtype,ltype>()); break;
976        case PLUSF: binaryOpVectorHelper(left, leftShape, leftOffset, right, rightShape, rightOffset, plus_func<ltype,rtype,ltype>()); break;
977        case MINUSF:binaryOpVectorHelper(left, leftShape, leftOffset, right, rightShape, rightOffset, minus_func<ltype,rtype,ltype>()); break;
978        case MULTIPLIESF:binaryOpVectorHelper(left, leftShape, leftOffset, right, rightShape, rightOffset, multiplies_func<ltype,rtype,ltype>()); break;
979        case DIVIDESF:binaryOpVectorHelper(left, leftShape, leftOffset, right, rightShape, rightOffset, divides_func<ltype,rtype,ltype>()); break;
980        case LESSF:
981        case GREATERF:
982        case GREATER_EQUALF:
983        case LESS_EQUALF:
984        default:
985          throw DataException("Unsupported binary operation");    
986      }
987    }
988    
989    
990    template <class LVEC, typename SCALAR, class BinaryFunction>
991    inline
992    void
993    binaryOpVectorHelper(LVEC& left,
994                const DataTypes::ShapeType& leftShape,
995                typename LVEC::size_type offset,
996                            SCALAR right,
997                            BinaryFunction operation)
998    {
999      for (DataTypes::RealVectorType::size_type i=0;i<DataTypes::noValues(leftShape);i++) {
1000      left[offset+i]=operation(left[offset+i],right);      left[offset+i]=operation(left[offset+i],right);
1001    }    }
1002  }  }
1003    
1004    
1005    template <class LVEC, typename SCALAR>
1006    inline
1007    void
1008    binaryOpVector(LVEC& left,
1009                const DataTypes::ShapeType& leftShape,
1010                typename LVEC::size_type offset,
1011                            SCALAR right,
1012                            escript::ESFunction operation)
1013    {
1014      typedef typename LVEC::ElementType ltype;
1015      typedef SCALAR rtype;  
1016      EsysAssert(((left.size()>0)&&checkOffset(left,leftShape,offset)),
1017                 "Error - Couldn't perform binaryOp due to insufficient storage in left object.");
1018      switch (operation)
1019      {
1020        case POWF: binaryOpVectorHelper(left, leftShape, offset, right, pow_func<ltype,rtype,ltype>()); break;
1021        case PLUSF: binaryOpVectorHelper(left, leftShape, offset, right, plus_func<ltype,rtype,ltype>()); break;
1022        case MINUSF:binaryOpVectorHelper(left, leftShape, offset, right, minus_func<ltype,rtype,ltype>()); break;
1023        case MULTIPLIESF:binaryOpVectorHelper(left, leftShape, offset, right, multiplies_func<ltype,rtype,ltype>()); break;
1024        case DIVIDESF:binaryOpVectorHelper(left, leftShape, offset, right, divides_func<ltype,rtype,ltype>()); break;
1025        case LESSF:
1026        case GREATERF:
1027        case GREATER_EQUALF:
1028        case LESS_EQUALF:
1029        default:
1030          throw DataException("Unsupported binary operation");    
1031      }  
1032    }
1033    
1034    
1035    // -------------------
1036    
1037    
1038  template <class BinaryFunction>  template <class BinaryFunction>
1039  inline  inline
1040  double  DataTypes::real_t
1041  reductionOp(const DataTypes::ValueType& left,  reductionOp(const DataTypes::RealVectorType& left,
1042                 const DataTypes::ShapeType& leftShape,                 const DataTypes::ShapeType& leftShape,
1043                 DataTypes::ValueType::size_type offset,                 DataTypes::RealVectorType::size_type offset,
1044                             BinaryFunction operation,                             BinaryFunction operation,
1045                             double initial_value)                             DataTypes::real_t initial_value)
1046  {  {
1047    EsysAssert(((left.size()>0)&&checkOffset(left,leftShape,offset)),    EsysAssert(((left.size()>0)&&checkOffset(left,leftShape,offset)),
1048                 "Error - Couldn't perform reductionOp due to insufficient storage.");                 "Error - Couldn't perform reductionOp due to insufficient storage.");
1049    double current_value=initial_value;    DataTypes::real_t current_value=initial_value;
1050    for (DataTypes::ValueType::size_type i=0;i<DataTypes::noValues(leftShape);i++) {    for (DataTypes::RealVectorType::size_type i=0;i<DataTypes::noValues(leftShape);i++) {
1051      current_value=operation(current_value,left[offset+i]);      current_value=operation(current_value,left[offset+i]);
1052    }    }
1053    return current_value;    return current_value;
1054  }  }
1055    
1056    template <class BinaryFunction>
1057    inline
1058    DataTypes::real_t
1059    reductionOp(const DataTypes::CplxVectorType& left,
1060                   const DataTypes::ShapeType& leftShape,
1061                   DataTypes::CplxVectorType::size_type offset,
1062                               BinaryFunction operation,
1063                               DataTypes::real_t initial_value)
1064    {
1065      EsysAssert(((left.size()>0)&&checkOffset(left,leftShape,offset)),
1066                   "Error - Couldn't perform reductionOp due to insufficient storage.");
1067      DataTypes::real_t current_value=initial_value;
1068      for (DataTypes::RealVectorType::size_type i=0;i<DataTypes::noValues(leftShape);i++) {
1069        current_value=operation(current_value,left[offset+i]);
1070      }
1071      return current_value;
1072    }
1073    
1074    
1075  /**  /**
1076       \brief       \brief
1077       computes the inverses of square (up to 3x3) matricies       computes the inverses of square (up to 3x3) matricies
# Line 909  reductionOp(const DataTypes::ValueType& Line 1089  reductionOp(const DataTypes::ValueType&
1089       \return 0 on success, on failure the return value should be passed to matrixInverseError(int err).       \return 0 on success, on failure the return value should be passed to matrixInverseError(int err).
1090  */  */
1091  int  int
1092  matrix_inverse(const DataTypes::ValueType& in,  matrix_inverse(const DataTypes::RealVectorType& in,
1093          const DataTypes::ShapeType& inShape,          const DataTypes::ShapeType& inShape,
1094              DataTypes::ValueType::size_type inOffset,              DataTypes::RealVectorType::size_type inOffset,
1095              DataTypes::ValueType& out,              DataTypes::RealVectorType& out,
1096          const DataTypes::ShapeType& outShape,          const DataTypes::ShapeType& outShape,
1097              DataTypes::ValueType::size_type outOffset,              DataTypes::RealVectorType::size_type outOffset,
1098          int count,          int count,
1099          LapackInverseHelper& helper);          LapackInverseHelper& helper);
1100    
# Line 934  matrixInverseError(int err); Line 1114  matrixInverseError(int err);
1114  */  */
1115  inline  inline
1116  bool  bool
1117  vectorHasNaN(const DataTypes::ValueType& in, DataTypes::ValueType::size_type inOffset, size_t count)  vectorHasNaN(const DataTypes::RealVectorType& in, DataTypes::RealVectorType::size_type inOffset, size_t count)
1118  {  {
1119      for (size_t z=inOffset;z<inOffset+count;++z)      for (size_t z=inOffset;z<inOffset+count;++z)
1120      {      {

Legend:
Removed from v.5962  
changed lines
  Added in v.5963

  ViewVC Help
Powered by ViewVC 1.1.26