C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
lrvecrmat.inl
00001 /*
00002 **  CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4)
00003 **
00004 **  Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
00005 **                          Universitaet Karlsruhe, Germany
00006 **            (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie
00007 **                          Universitaet Wuppertal, Germany   
00008 **
00009 **  This library is free software; you can redistribute it and/or
00010 **  modify it under the terms of the GNU Library General Public
00011 **  License as published by the Free Software Foundation; either
00012 **  version 2 of the License, or (at your option) any later version.
00013 **
00014 **  This library is distributed in the hope that it will be useful,
00015 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 **  Library General Public License for more details.
00018 **
00019 **  You should have received a copy of the GNU Library General Public
00020 **  License along with this library; if not, write to the Free
00021 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 */
00023 
00024 /* CVS $Id: lrvecrmat.inl,v 1.25 2014/01/30 17:23:47 cxsc Exp $ */
00025 
00026 // Here are definitions for l_rvector x rmatrix-Functions
00027 #ifndef _CXSC_LRVECRMAT_INL_INCLUDED
00028 #define _CXSC_LRVECRMAT_INL_INCLUDED
00029 
00030 namespace cxsc {
00031 
00032         INLINE l_rvector::l_rvector(const rmatrix &sl)
00033 #if(CXSC_INDEX_CHECK)
00034         throw(ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ)
00035 #else
00036         throw()
00037 #endif
00038         { _vmconstr<l_rvector,rmatrix,l_real>(*this,sl); }
00039         INLINE l_rvector::l_rvector(const rmatrix_slice &sl)
00040 #if(CXSC_INDEX_CHECK)
00041         throw(ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ)
00042 #else
00043         throw()
00044 #endif
00045         { _vmsconstr<l_rvector,rmatrix_slice,l_real>(*this,sl); }
00046         INLINE l_rvector::l_rvector(const rmatrix_subv &v) throw():l(v.lb),u(v.ub),size(v.size)
00047         {
00048                 dat=new l_real[size];
00049                 for (int i=0, j=v.start;i<v.size;i++,j+=v.offset)
00050                         dat[i]=v.dat[j];
00051         }
00057         INLINE l_rvector _l_rvector(const rmatrix &sl)
00058 #if(CXSC_INDEX_CHECK)
00059         throw(ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ)
00060 #else
00061         throw()
00062 #endif
00063         { return l_rvector(sl); }
00069         INLINE l_rvector _l_rvector(const rmatrix_slice &sl)
00070 #if(CXSC_INDEX_CHECK)
00071         throw(ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ)
00072 #else
00073         throw()
00074 #endif
00075         { return l_rvector(sl); }
00076 
00077         INLINE void accumulate(dotprecision &dp, const rmatrix_subv & rv1, const l_rvector &rv2)
00078 #if(CXSC_INDEX_CHECK)
00079         throw(OP_WITH_WRONG_DIM)
00080 #else
00081         throw()
00082 #endif
00083         { _vmvaccu<dotprecision,l_rvector,rmatrix_subv>(dp,rv2,rv1); }
00084         INLINE void accumulate(dotprecision &dp, const l_rvector & rv1, const rmatrix_subv &rv2)
00085 #if(CXSC_INDEX_CHECK)
00086         throw(OP_WITH_WRONG_DIM)
00087 #else
00088         throw()
00089 #endif
00090         { _vmvaccu<dotprecision,l_rvector,rmatrix_subv>(dp,rv1,rv2); }
00091         INLINE void accumulate(idotprecision &dp, const rmatrix_subv & rv1, const l_rvector &rv2)
00092 #if(CXSC_INDEX_CHECK)
00093         throw(OP_WITH_WRONG_DIM)
00094 #else
00095         throw()
00096 #endif
00097         { _vmvaccu<idotprecision,l_rvector,rmatrix_subv>(dp,rv2,rv1); }
00098         INLINE void accumulate(idotprecision &dp, const l_rvector & rv1, const rmatrix_subv &rv2)
00099 #if(CXSC_INDEX_CHECK)
00100         throw(OP_WITH_WRONG_DIM)
00101 #else
00102         throw()
00103 #endif
00104         { _vmvaccu<idotprecision,l_rvector,rmatrix_subv>(dp,rv1,rv2); }
00105         
00106         INLINE void accumulate(dotprecision &dp, const rmatrix_subv & rv1, const l_rvector_slice &rv2)
00107 #if(CXSC_INDEX_CHECK)
00108         throw(OP_WITH_WRONG_DIM)
00109 #else
00110         throw()
00111 #endif
00112         { _vmvaccu<dotprecision,l_rvector,rmatrix_subv>(dp,l_rvector(rv2),rv1); }
00113         INLINE void accumulate(dotprecision &dp, const l_rvector_slice & rv1, const rmatrix_subv &rv2)
00114 #if(CXSC_INDEX_CHECK)
00115         throw(OP_WITH_WRONG_DIM)
00116 #else
00117         throw()
00118 #endif
00119         { _vmvaccu<dotprecision,l_rvector,rmatrix_subv>(dp,l_rvector(rv1),rv2); }
00120         INLINE void accumulate(idotprecision &dp, const rmatrix_subv & rv1, const l_rvector_slice &rv2)
00121 #if(CXSC_INDEX_CHECK)
00122         throw(OP_WITH_WRONG_DIM)
00123 #else
00124         throw()
00125 #endif
00126         { _vmvaccu<idotprecision,l_rvector,rmatrix_subv>(dp,l_rvector(rv2),rv1); }
00127         INLINE void accumulate(idotprecision &dp, const l_rvector_slice & rv1, const rmatrix_subv &rv2)
00128 #if(CXSC_INDEX_CHECK)
00129         throw(OP_WITH_WRONG_DIM)
00130 #else
00131         throw()
00132 #endif
00133         { _vmvaccu<idotprecision,l_rvector,rmatrix_subv>(dp,l_rvector(rv1),rv2); }
00134 
00135         INLINE l_rvector &l_rvector::operator =(const rmatrix_subv &mv) throw() { return _vmvassign<l_rvector,rmatrix_subv,l_real>(*this,mv); }
00136         INLINE l_rvector_slice &l_rvector_slice::operator =(const rmatrix_subv &mv) throw() { return _vsvassign(*this,rvector(mv)); }
00137         INLINE l_rvector &l_rvector::operator =(const rmatrix &m)
00138 #if(CXSC_INDEX_CHECK)
00139         throw(ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ)
00140 #else
00141         throw()
00142 #endif
00143         { return _vmassign<l_rvector,rmatrix,l_real>(*this,m); }
00144         INLINE l_rvector &l_rvector::operator =(const rmatrix_slice &m)
00145 #if(CXSC_INDEX_CHECK)
00146         throw(ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ)
00147 #else
00148         throw()
00149 #endif
00150         { return _vmassign<l_rvector,rmatrix,l_real>(*this,rmatrix(m)); }
00151         INLINE l_rvector_slice &l_rvector_slice::operator =(const rmatrix &m)
00152 #if(CXSC_INDEX_CHECK)
00153         throw(ERROR__OP_WITH_WRONG_DIM<rvector>,ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ)
00154 #else
00155         throw()
00156 #endif
00157         { return _vsvassign(*this,rvector(m)); }
00158         INLINE l_rvector_slice & l_rvector_slice::operator =(const rmatrix_slice &m)
00159 #if(CXSC_INDEX_CHECK)
00160         throw(ERROR__OP_WITH_WRONG_DIM<rvector>,ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ)
00161 #else
00162         throw()
00163 #endif
00164         { return _vsvassign(*this,l_rvector(rmatrix(m))); }
00165 
00166         INLINE l_rvector operator *(const rmatrix &m,const l_rvector &v)
00167 #if(CXSC_INDEX_CHECK)
00168         throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM)
00169 #else
00170         throw()
00171 #endif
00172         { return _mvlmult<rmatrix,l_rvector,l_rvector>(m,v); }
00173         INLINE l_rvector operator *(const rmatrix_slice &ms,const l_rvector &v)
00174 #if(CXSC_INDEX_CHECK)
00175         throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM)
00176 #else
00177         throw()
00178 #endif
00179         { return _msvlmult<rmatrix_slice,l_rvector,l_rvector>(ms,v); }
00180         INLINE l_rvector operator *(const l_rvector &v,const rmatrix &m)
00181 #if(CXSC_INDEX_CHECK)
00182         throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM)
00183 #else
00184         throw()
00185 #endif
00186         { return _vmlmult<l_rvector,rmatrix,l_rvector>(v,m); }
00187         INLINE l_rvector operator *(const l_rvector &v,const rmatrix_slice &ms)
00188 #if(CXSC_INDEX_CHECK)
00189         throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM)
00190 #else
00191         throw()
00192 #endif
00193         { return _vmslmult<l_rvector,rmatrix_slice,l_rvector>(v,ms); }
00194         INLINE l_rvector &operator *=(l_rvector &v,const rmatrix &m)
00195 #if(CXSC_INDEX_CHECK)
00196         throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM)
00197 #else
00198         throw()
00199 #endif
00200         { return _vmlmultassign<l_rvector,rmatrix,l_real>(v,m); }
00201         INLINE l_rvector &operator *=(l_rvector &v,const rmatrix_slice &ms)
00202 #if(CXSC_INDEX_CHECK)
00203         throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM)
00204 #else
00205         throw()
00206 #endif
00207         { return _vmslmultassign<l_rvector,rmatrix_slice,l_real>(v,ms); }
00208 
00209         INLINE l_rvector operator *(const l_rvector_slice &v,const rmatrix &m)
00210 #if(CXSC_INDEX_CHECK)
00211         throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM)
00212 #else
00213         throw()
00214 #endif
00215         { return _vmlmult<l_rvector,rmatrix,l_rvector>(l_rvector(v),m); }
00216         INLINE l_rvector_slice &l_rvector_slice::operator *=(const rmatrix &m)
00217 #if(CXSC_INDEX_CHECK)
00218         throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM)
00219 #else
00220         throw()
00221 #endif
00222         { *this=*this*m; return *this; }
00223         
00224 } // namespace cxsc
00225 
00226 #endif
00227