C-XSC - A C++ Class Library for Extended Scientific Computing
2.5.4
|
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: cvecrmat.inl,v 1.24 2014/01/30 17:23:44 cxsc Exp $ */ 00025 00026 // Here are definitions for cvector x rmatrix-Functions 00027 #ifndef _CXSC_CVECRMAT_INL_INCLUDED 00028 #define _CXSC_CVECRMAT_INL_INCLUDED 00029 00030 namespace cxsc { 00031 00032 INLINE cvector::cvector(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<cvector,rmatrix,complex>(*this,sl); } 00039 INLINE cvector::cvector(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<cvector,rmatrix_slice,complex>(*this,sl); } 00046 INLINE cvector::cvector(const rmatrix_subv &v) throw():l(v.lb),u(v.ub),size(v.size) 00047 { 00048 dat=new complex[size]; 00049 for (int i=0, j=v.start;i<v.size;i++,j+=v.offset) 00050 dat[i]=v.dat[j]; 00051 } 00052 INLINE cvector _cvector(const rmatrix &sl) 00053 #if(CXSC_INDEX_CHECK) 00054 throw(ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ) 00055 #else 00056 throw() 00057 #endif 00058 { return cvector(sl); } 00059 INLINE cvector _cvector(const rmatrix_slice &sl) 00060 #if(CXSC_INDEX_CHECK) 00061 throw(ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ) 00062 #else 00063 throw() 00064 #endif 00065 { return cvector(sl); } 00066 00067 // INLINE void accumulate(cdotprecision &dp, const rmatrix_subv & rv1, const cvector &rv2) 00068 // #if(CXSC_INDEX_CHECK) 00069 // throw(OP_WITH_WRONG_DIM) 00070 // #else 00071 // throw() 00072 // #endif 00073 // { _vmvaccu<cdotprecision,cvector,rmatrix_subv>(dp,rv2,rv1); } 00074 // INLINE void accumulate(cdotprecision &dp, const cvector & rv1, const rmatrix_subv &rv2) 00075 // #if(CXSC_INDEX_CHECK) 00076 // throw(OP_WITH_WRONG_DIM) 00077 // #else 00078 // throw() 00079 // #endif 00080 // { _vmvaccu<cdotprecision,cvector,rmatrix_subv>(dp,rv1,rv2); } 00081 // INLINE void accumulate(cidotprecision &dp, const rmatrix_subv & rv1, const cvector &rv2) 00082 // #if(CXSC_INDEX_CHECK) 00083 // throw(OP_WITH_WRONG_DIM) 00084 // #else 00085 // throw() 00086 // #endif 00087 // { _vmvaccu<cidotprecision,cvector,rmatrix_subv>(dp,rv2,rv1); } 00088 // INLINE void accumulate(cidotprecision &dp, const cvector & rv1, const rmatrix_subv &rv2) 00089 // #if(CXSC_INDEX_CHECK) 00090 // throw(OP_WITH_WRONG_DIM) 00091 // #else 00092 // throw() 00093 // #endif 00094 // { _vmvaccu<cidotprecision,cvector,rmatrix_subv>(dp,rv1,rv2); } 00095 // 00096 // INLINE void accumulate(cdotprecision &dp, const rmatrix_subv & rv1, const cvector_slice &rv2) 00097 // #if(CXSC_INDEX_CHECK) 00098 // throw(OP_WITH_WRONG_DIM) 00099 // #else 00100 // throw() 00101 // #endif 00102 // { _vmvaccu<cdotprecision,cvector,rmatrix_subv>(dp,cvector(rv2),rv1); } 00103 // INLINE void accumulate(cdotprecision &dp, const cvector_slice & rv1, const rmatrix_subv &rv2) 00104 // #if(CXSC_INDEX_CHECK) 00105 // throw(OP_WITH_WRONG_DIM) 00106 // #else 00107 // throw() 00108 // #endif 00109 // { _vmvaccu<cdotprecision,cvector,rmatrix_subv>(dp,cvector(rv1),rv2); } 00110 // INLINE void accumulate(cidotprecision &dp, const rmatrix_subv & rv1, const cvector_slice &rv2) 00111 // #if(CXSC_INDEX_CHECK) 00112 // throw(OP_WITH_WRONG_DIM) 00113 // #else 00114 // throw() 00115 // #endif 00116 // { _vmvaccu<cidotprecision,cvector,rmatrix_subv>(dp,cvector(rv2),rv1); } 00117 // INLINE void accumulate(cidotprecision &dp, const cvector_slice & rv1, const rmatrix_subv &rv2) 00118 // #if(CXSC_INDEX_CHECK) 00119 // throw(OP_WITH_WRONG_DIM) 00120 // #else 00121 // throw() 00122 // #endif 00123 // { _vmvaccu<cidotprecision,cvector,rmatrix_subv>(dp,cvector(rv1),rv2); } 00124 00125 INLINE cvector &cvector::operator =(const rmatrix_subv &mv) throw() { return _vmvassign<cvector,rmatrix_subv,complex>(*this,mv); } 00126 INLINE cvector_slice &cvector_slice::operator =(const rmatrix_subv &mv) throw() { return _vsvassign(*this,rvector(mv)); } 00127 INLINE cvector &cvector::operator =(const rmatrix &m) 00128 #if(CXSC_INDEX_CHECK) 00129 throw(ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ) 00130 #else 00131 throw() 00132 #endif 00133 { return _vmassign<cvector,rmatrix,complex>(*this,m); } 00134 INLINE cvector &cvector::operator =(const rmatrix_slice &m) 00135 #if(CXSC_INDEX_CHECK) 00136 throw(ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ) 00137 #else 00138 throw() 00139 #endif 00140 { return _vmassign<cvector,rmatrix,complex>(*this,rmatrix(m)); } 00141 INLINE cvector_slice &cvector_slice::operator =(const rmatrix &m) 00142 #if(CXSC_INDEX_CHECK) 00143 throw(ERROR__OP_WITH_WRONG_DIM<rvector>,ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ) 00144 #else 00145 throw() 00146 #endif 00147 { return _vsvassign(*this,rvector(m)); } 00148 INLINE cvector_slice & cvector_slice::operator =(const rmatrix_slice &m) 00149 #if(CXSC_INDEX_CHECK) 00150 throw(ERROR__OP_WITH_WRONG_DIM<rvector>,ERROR_RMATRIX_TYPE_CAST_OF_THICK_OBJ) 00151 #else 00152 throw() 00153 #endif 00154 { return _vsvassign(*this,cvector(rmatrix(m))); } 00155 00156 INLINE cvector operator *(const rmatrix &m,const cvector &v) 00157 #if(CXSC_INDEX_CHECK) 00158 throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM) 00159 #else 00160 throw() 00161 #endif 00162 { return _mvcmult<rmatrix,cvector,cvector>(m,v); } 00163 INLINE cvector operator *(const rmatrix_slice &ms,const cvector &v) 00164 #if(CXSC_INDEX_CHECK) 00165 throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM) 00166 #else 00167 throw() 00168 #endif 00169 { return _msvcmult<rmatrix_slice,cvector,cvector>(ms,v); } 00170 INLINE cvector operator *(const cvector &v,const rmatrix &m) 00171 #if(CXSC_INDEX_CHECK) 00172 throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM) 00173 #else 00174 throw() 00175 #endif 00176 { return _vmcmult<cvector,rmatrix,cvector>(v,m); } 00177 INLINE cvector operator *(const cvector &v,const rmatrix_slice &ms) 00178 #if(CXSC_INDEX_CHECK) 00179 throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM) 00180 #else 00181 throw() 00182 #endif 00183 { return _vmscmult<cvector,rmatrix_slice,cvector>(v,ms); } 00184 INLINE cvector &operator *=(cvector &v,const rmatrix &m) 00185 #if(CXSC_INDEX_CHECK) 00186 throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM) 00187 #else 00188 throw() 00189 #endif 00190 { return _vmcmultassign<cvector,rmatrix,complex>(v,m); } 00191 INLINE cvector &operator *=(cvector &v,const rmatrix_slice &ms) 00192 #if(CXSC_INDEX_CHECK) 00193 throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM) 00194 #else 00195 throw() 00196 #endif 00197 { return _vmscmultassign<cvector,rmatrix_slice,complex>(v,ms); } 00198 00199 INLINE cvector operator *(const cvector_slice &v,const rmatrix &m) 00200 #if(CXSC_INDEX_CHECK) 00201 throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM) 00202 #else 00203 throw() 00204 #endif 00205 { return _vmcmult<cvector,rmatrix,cvector>(cvector(v),m); } 00206 INLINE cvector_slice &cvector_slice::operator *=(const rmatrix &m) 00207 #if(CXSC_INDEX_CHECK) 00208 throw(ERROR_RMATRIX_OP_WITH_WRONG_DIM) 00209 #else 00210 throw() 00211 #endif 00212 { return _vsmcmultassign<cvector_slice,rmatrix,complex>(*this,m); } 00213 00214 } // namespace cxsc 00215 00216 #endif 00217