scmatrix.hpp

00001 /*
00002 **  CXSC is a C++ library for eXtended Scientific Computing (V 2.5.1)
00003 **
00004 **  Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
00005 **                          Universitaet Karlsruhe, Germany
00006 **            (C) 2000-2011 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: scmatrix.hpp,v 1.14 2011/06/07 15:17:41 cxsc Exp $ */
00025 
00026 #ifndef _CXSC_SCMATRIX_HPP_INCLUDED
00027 #define _CXSC_SCMATRIX_HPP_INCLUDED
00028 
00029 #include <complex.hpp>
00030 #include <cmatrix.hpp>
00031 #include <scvector.hpp>
00032 #include <cidot.hpp>
00033 #include <vector>
00034 #include <algorithm>
00035 #include <iostream>
00036 #include <sparsecdot.hpp>
00037 #include <sparsematrix.hpp>
00038 #include <srmatrix.hpp>
00039 
00040 namespace cxsc {
00041 
00042 //definiert in srmatrix.hpp
00043 //enum STORAGE_TYPE{triplet,compressed_row,compressed_column};
00044 
00045 class scmatrix_slice;
00046 class scmatrix_subv;
00047 class scimatrix;
00048 class scimatrix_slice;
00049 class scimatrix_subv;
00050 
00051 
00052 inline bool comp_pair_c(std::pair<int,complex> p1, std::pair<int,complex> p2) {
00053   return p1.first < p2.first;
00054 }
00055 
00056 class scmatrix {
00057 
00058   private:
00059     std::vector<int> p;
00060     std::vector<int> ind;
00061     std::vector<complex> x;
00062     int m;
00063     int n;
00064     int lb1,ub1,lb2,ub2;
00065 
00066   public:
00067 
00068     std::vector<int>& column_pointers() {
00069       return p;
00070     }
00071 
00072     std::vector<int>& row_indices() {
00073       return ind;
00074     }
00075 
00076     std::vector<complex>& values() {
00077       return x;
00078     }
00079 
00080     const std::vector<int>& column_pointers() const {
00081       return p;
00082     }
00083 
00084     const std::vector<int>& row_indices() const {
00085       return ind;
00086     }
00087 
00088     const std::vector<complex>& values() const {
00089       return x;
00090     }
00091 
00092     scmatrix() {
00093       p.push_back(0);
00094       m = n = 0;
00095       lb1 = lb2 = ub1 = ub2 = 0;
00096     }
00097 
00098     scmatrix(const int r, const int c) : m(r),n(c),lb1(1),ub1(r),lb2(1),ub2(c) {
00099       p = std::vector<int>((n>0) ? n+1 : 1, 0);
00100       ind.reserve(2*(m+n));
00101       x.reserve(2*(m+n));
00102 
00103       p[0] = 0;
00104     }
00105 
00106     scmatrix(const int r, const int c, const int e) : m(r),n(c),lb1(1),ub1(r),lb2(1),ub2(c) {
00107       p = std::vector<int>((n>0) ? n+1 : 1, 0);
00108       ind.reserve(e);
00109       x.reserve(e);
00110 
00111       p[0] = 0;
00112     }
00113 
00114     scmatrix(const int m, const int n, const int nnz, const intvector& rows, const intvector& cols, const cvector& values, const enum STORAGE_TYPE t = triplet) {
00115       if(t == triplet) {
00116          this->m = m;
00117          this->n = n;
00118          p = std::vector<int>(n+1,0);
00119          ind.reserve(nnz);
00120          x.reserve(nnz);
00121          lb1 = lb2 = 1;
00122          ub1 = m; ub2 = n;
00123 
00124          std::vector<triplet_store<complex> > work;
00125          work.reserve(nnz);
00126 
00127          for(int k=0 ; k<nnz ; k++) {
00128            work.push_back(triplet_store<complex>(rows[Lb(rows)+k],cols[Lb(cols)+k],values[Lb(values)+k]));
00129          }
00130 
00131          sort(work.begin(), work.end());
00132 
00133          int i=0;
00134 
00135          for(int j=0 ; j<n ; j++) {        
00136 
00137            while((unsigned int)i < work.size() && work[i].col == j ) {
00138                ind.push_back(work[i].row);
00139                x.push_back(work[i].val);
00140                i++;
00141            }
00142 
00143            p[j+1] = i;
00144          }
00145          
00146       } else if(t == compressed_row) {
00147 
00148          this->m = m;
00149          this->n = n;
00150          p = std::vector<int>(n+1,0);
00151          ind.reserve(nnz);
00152          x.reserve(nnz);
00153          lb1 = lb2 = 1;
00154          ub1 = m; ub2 = n;
00155 
00156          for(int i=0 ; i<n+1 ; i++)
00157            p[i] = rows[Lb(rows)+i];
00158 
00159          std::vector<triplet_store<complex> > work;
00160          work.reserve(nnz);
00161 
00162          for(int j=0 ; j<n ; j++) {
00163            for(int k=p[j] ; k<p[j+1] ; k++) {
00164              work.push_back(triplet_store<complex>(j,cols[Lb(cols)+k],values[Lb(values)+k]));
00165            }
00166          }
00167 
00168          sort(work.begin(), work.end());
00169 
00170          int i=0;
00171 
00172          for(int j=0 ; j<n ; j++) {        
00173 
00174            while((unsigned int)i < work.size() && work[i].col == j ) {
00175                ind.push_back(work[i].row);
00176                x.push_back(work[i].val);
00177                i++;
00178            }
00179 
00180            p[j+1] = i;
00181          }
00182     
00183       } else if(t == compressed_column) {
00184          this->m = m;
00185          this->n = n;
00186          p = std::vector<int>(n+1,0);
00187          ind.reserve(nnz);
00188          x.reserve(nnz);
00189          lb1 = lb2 = 1;
00190          ub1 = m; ub2 = n;
00191 
00192          for(int i=0 ; i<n+1 ; i++)
00193            p[i] = rows[Lb(rows)+i];
00194 
00195          std::vector<std::pair<int,complex> > work;
00196          work.reserve(n);
00197 
00198          for(int j=0 ; j<n ; j++) {
00199            work.clear();
00200 
00201            for(int k=p[j] ; k<p[j+1] ; k++) {
00202              work.push_back(std::make_pair(cols[Lb(cols)+k],values[Lb(values)+k]));
00203            }
00204 
00205            std::sort(work.begin(),work.end(),comp_pair_c);
00206 
00207            for(unsigned int i=0 ; i<work.size() ; i++) {
00208              ind.push_back(work[i].first);
00209              x.push_back(work[i].second);
00210            }
00211          }
00212 
00213       }
00214 
00215     }
00216 
00217     scmatrix(const int m, const int n, const int nnz, const int* rows, const int* cols, const complex* values, const enum STORAGE_TYPE t = triplet) {
00218       if(t == triplet) {
00219          this->m = m;
00220          this->n = n;
00221          p = std::vector<int>(n+1,0);
00222          ind.reserve(nnz);
00223          x.reserve(nnz);
00224          lb1 = lb2 = 1;
00225          ub1 = m; ub2 = n;
00226 
00227          std::vector<triplet_store<complex> > work;
00228          work.reserve(nnz);
00229 
00230          for(int k=0 ; k<nnz ; k++) {
00231            work.push_back(triplet_store<complex>(rows[k],cols[k],values[k]));
00232          }
00233 
00234          sort(work.begin(), work.end());
00235 
00236          int i=0;
00237 
00238          for(int j=0 ; j<n ; j++) {        
00239 
00240            while((unsigned int)i < work.size() && work[i].col == j ) {
00241                ind.push_back(work[i].row);
00242                x.push_back(work[i].val);
00243                i++;
00244            }
00245 
00246            p[j+1] = i;
00247          }
00248          
00249       } else if(t == compressed_row) {
00250 
00251          this->m = m;
00252          this->n = n;
00253          p = std::vector<int>(n+1,0);
00254          ind.reserve(nnz);
00255          x.reserve(nnz);
00256          lb1 = lb2 = 1;
00257          ub1 = m; ub2 = n;
00258 
00259          for(int i=0 ; i<n+1 ; i++)
00260            p[i] = rows[i];
00261 
00262          std::vector<triplet_store<complex> > work;
00263          work.reserve(nnz);
00264 
00265          for(int j=0 ; j<n ; j++) {
00266            for(int k=p[j] ; k<p[j+1] ; k++) {
00267              work.push_back(triplet_store<complex>(j,cols[k],values[k]));
00268            }
00269          }
00270 
00271          sort(work.begin(), work.end());
00272 
00273          int i=0;
00274 
00275          for(int j=0 ; j<n ; j++) {        
00276 
00277            while((unsigned int)i < work.size() && work[i].col == j ) {
00278                ind.push_back(work[i].row);
00279                x.push_back(work[i].val);
00280                i++;
00281            }
00282 
00283            p[j+1] = i;
00284          }
00285     
00286       } else if(t == compressed_column) {
00287          this->m = m;
00288          this->n = n;
00289          p = std::vector<int>(n+1,0);
00290          ind.reserve(nnz);
00291          x.reserve(nnz);
00292          lb1 = lb2 = 1;
00293          ub1 = m; ub2 = n;
00294 
00295          for(int i=0 ; i<n+1 ; i++)
00296            p[i] = rows[i];
00297 
00298          std::vector<std::pair<int,complex> > work;
00299          work.reserve(n);
00300 
00301          for(int j=0 ; j<n ; j++) {
00302            work.clear();
00303 
00304            for(int k=p[j] ; k<p[j+1] ; k++) {
00305              work.push_back(std::make_pair(cols[k],values[k]));
00306            }
00307 
00308            std::sort(work.begin(),work.end(),comp_pair_c);
00309 
00310            for(unsigned int i=0 ; i<work.size() ; i++) {
00311              ind.push_back(work[i].first);
00312              x.push_back(work[i].second);
00313            }
00314          }
00315 
00316       }
00317 
00318     }
00319 
00320 
00321     scmatrix(const srmatrix& A) : p(A.p), ind(A.ind), m(A.m), n(A.n), lb1(A.lb1), ub1(A.ub1), lb2(A.lb2), ub2(A.ub2) {
00322       x.reserve(A.get_nnz());
00323       for(unsigned int i=0 ; i<A.x.size() ; i++)
00324         x.push_back(complex(A.x[i]));
00325     }
00326 
00327 
00328     scmatrix(const rmatrix& A) : m(ColLen(A)),n(RowLen(A)),lb1(Lb(A,1)),ub1(Ub(A,1)),lb2(Lb(A,2)),ub2(Ub(A,2)) {
00329       p = std::vector<int>((n>0) ? n+1 : 1, 0);
00330       ind.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
00331       x.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
00332 
00333       p[0] = 0;
00334       int nnz = 0;
00335 
00336       for(int j=0 ; j<n ; j++) {
00337         for(int i=0 ; i<m ; i++) {
00338           if(A[i+lb1][j+lb2] != 0.0) {
00339              ind.push_back(i);
00340              x.push_back(complex(A[i+lb1][j+lb2]));
00341              nnz++;
00342           }
00343         }
00344           
00345         p[j+1] = nnz;
00346       }
00347 
00348     }
00349 
00350     scmatrix(const cmatrix& A) : m(ColLen(A)),n(RowLen(A)),lb1(Lb(A,1)),ub1(Ub(A,1)),lb2(Lb(A,2)),ub2(Ub(A,2)) {
00351       p = std::vector<int>((n>0) ? n+1 : 1, 0);
00352       ind.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
00353       x.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
00354 
00355       p[0] = 0;
00356       int nnz = 0;
00357 
00358       for(int j=0 ; j<n ; j++) {
00359         for(int i=0 ; i<m ; i++) {
00360           if(A[i+lb1][j+lb2] != 0.0) {
00361              ind.push_back(i);
00362              x.push_back(complex(A[i+lb1][j+lb2]));
00363              nnz++;
00364           }
00365         }
00366           
00367         p[j+1] = nnz;
00368       }
00369 
00370     }
00371 
00372     scmatrix(const int ms, const int ns, const cmatrix& A) : m(ms), n(ns), lb1(1), ub1(ms), lb2(1), ub2(ns)  {
00373       //Banded matrix constructor
00374       int nnz = RowLen(A)*ColLen(A);
00375       p = std::vector<int>((n>0) ? n+1 : 1, 0);
00376       ind.reserve(nnz);
00377       x.reserve(nnz);
00378 
00379       std::vector<triplet_store<complex> > work;
00380       work.reserve(nnz);
00381 
00382       
00383       for(int i=0 ; i<ColLen(A) ; i++) {
00384         for(int j=Lb(A,2) ; j<=Ub(A,2) ; j++) {
00385           if(i+j >=0  &&  i+j < n) {
00386             work.push_back(triplet_store<complex>(i,i+j,A[i+Lb(A,1)][j]));
00387           }
00388         }
00389       }
00390 
00391       sort(work.begin(), work.end());
00392 
00393       int i=0;
00394 
00395       for(int j=0 ; j<n ; j++) {        
00396 
00397         while((unsigned int)i < work.size() && work[i].col == j ) {
00398           ind.push_back(work[i].row);
00399           x.push_back(work[i].val);
00400           i++;
00401         }
00402 
00403         p[j+1] = i;
00404       }
00405 
00406     }
00407 
00408     scmatrix(const srmatrix_slice&);
00409     scmatrix(const scmatrix_slice&);
00410 
00411     void full(cmatrix& A) const {
00412        A = cmatrix(lb1,ub1,lb2,ub2);
00413        A = 0.0;
00414        for(int j=0 ; j<n ; j++) {
00415           for(int k=p[j] ; k<p[j+1] ; k++) {
00416              A[ind[k]+lb1][j+lb2] = x[k];
00417           }
00418        }
00419     }
00420 
00421     void dropzeros() {
00422       std::vector<int> pnew(n+1,0);
00423       std::vector<int> indnew;
00424       std::vector<complex> xnew;
00425       int nnznew = 0;
00426 
00427       for(int j=0 ; j<n ; j++) {
00428         for(int k=p[j] ; k<p[j+1] ; k++) {
00429           if(x[k] != 0.0) {
00430             xnew.push_back(x[k]);
00431             indnew.push_back(ind[k]);
00432             nnznew++;
00433           }
00434         }
00435         pnew[j+1] = nnznew;
00436       }
00437 
00438       p = pnew;
00439       ind = indnew;
00440       x = xnew;
00441     }
00442 
00443 
00444     scmatrix& operator=(const real& A) {
00445       return sp_ms_assign<scmatrix,real,complex>(*this,A);
00446     }
00447 
00448     scmatrix& operator=(const complex& A) {
00449       return sp_ms_assign<scmatrix,complex,complex>(*this,A);
00450     }
00451 
00452     scmatrix& operator=(const rmatrix& A) {
00453       return spf_mm_assign<scmatrix,rmatrix,complex>(*this,A);
00454     }
00455 
00456     scmatrix& operator=(const cmatrix& A) {
00457       return spf_mm_assign<scmatrix,cmatrix,complex>(*this,A);
00458     }
00459 
00460     scmatrix& operator=(const rmatrix_slice& A) {
00461       return spf_mm_assign<scmatrix,rmatrix_slice,complex>(*this,A);
00462     }
00463 
00464     scmatrix& operator=(const cmatrix_slice& A) {
00465       return spf_mm_assign<scmatrix,cmatrix_slice,complex>(*this,A);
00466     }
00467 
00468     scmatrix& operator=(const srmatrix& A) {
00469       m = A.m;
00470       n = A.n;
00471       p = A.p;
00472       ind = A.ind;
00473       x.clear();
00474       x.reserve(A.get_nnz());
00475       for(unsigned int i=0 ; i<A.x.size() ; i++)
00476         x.push_back(complex(A.x[i]));
00477       return *this;
00478     }
00479 
00480     /* scmatrix& operator=(const scmatrix& A) {
00481       p = A.p;
00482       ind = A.ind;
00483       x = A.x;
00484       return *this;
00485     } */
00486 
00487     scmatrix& operator=(const srmatrix_slice&);
00488     scmatrix& operator=(const scmatrix_slice&);
00489 
00490     const complex operator()(int i, int j) const {
00491 #if(CXSC_INDEX_CHECK)
00492       if(i<lb1 || i>ub1 || j<lb2 || j>ub2)
00493         cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator()(int, int)"));
00494 #endif
00495       complex r(0.0);
00496       for(int k=p[j-lb2] ; k<p[j-lb2+1] && ind[k]<=i-lb1 ; k++) {
00497         if(ind[k] == i-lb1)  r = x[k];
00498       }
00499       return r;
00500     }
00501 
00502     complex& element(int i, int j) {
00503 #if(CXSC_INDEX_CHECK)
00504       if(i<lb1 || i>ub1 || j<lb2 || j>ub2)
00505         cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::element()(int, int)"));
00506 #endif
00507       int k;
00508       for(k=p[j-lb2] ; k<p[j-lb2+1] && ind[k]<=i-lb1 ; k++) {
00509         if(ind[k] == i-lb1)  return x[k];
00510       }
00511 
00512       //Nicht gefunden, Element muss angelegt werden, da Schreibzugriff moeglich
00513       std::vector<int>::iterator ind_it = ind.begin() + k;
00514       std::vector<complex>::iterator x_it  = x.begin() + k;
00515       ind.insert(ind_it, i-lb1);
00516       x_it = x.insert(x_it, complex(0.0));
00517       for(k=j-lb2+1 ; k<(int)p.size() ; k++)
00518         p[k]++;
00519 
00520       return *x_it;
00521     }
00522 
00523     scmatrix_subv operator[](const cxscmatrix_column&);
00524     scmatrix_subv operator[](const int);
00525     const scmatrix_subv operator[](const cxscmatrix_column&) const;
00526     const scmatrix_subv operator[](const int) const;
00527 
00528     scmatrix_slice operator()(const int, const int , const int, const int);
00529 
00530     scmatrix operator()(const intvector& pervec, const intvector& q) {
00531       scmatrix A(m,n,get_nnz());
00532       intvector per = perminv(pervec);
00533 
00534       int nnz=0;
00535       for(int k=0 ; k<n ; k++) {
00536         A.p[k] = nnz;
00537 
00538         std::map<int,complex> work;
00539         for(int j=p[q[Lb(q)+k]] ; j<p[q[Lb(q)+k]+1] ; j++) 
00540            work.insert(std::make_pair(per[Lb(per)+ind[j]], x[j]));
00541         
00542         for(std::map<int,complex>::iterator it = work.begin() ; it != work.end() ; it++) {
00543            A.ind.push_back(it->first);
00544            A.x.push_back(it->second);
00545         }
00546 
00547         nnz += work.size();
00548  
00549       }
00550 
00551       A.p[n] = nnz;
00552 
00553       return A;
00554     }
00555 
00556     scmatrix operator()(const intvector& pervec) {
00557       scmatrix A(m,n,get_nnz());
00558       intvector per = perminv(pervec);
00559 
00560       for(int k=0 ; k<n ; k++) {
00561         A.p[k] = p[k];
00562 
00563         std::map<int,complex> work;
00564         for(int j=p[k] ; j<p[k+1] ; j++) 
00565            work.insert(std::make_pair(per[Lb(per)+ind[j]], x[j]));
00566         
00567         for(std::map<int,complex>::iterator it = work.begin() ; it != work.end() ; it++) {
00568            A.ind.push_back(it->first);
00569            A.x.push_back(it->second);
00570         }
00571  
00572       }
00573 
00574       A.p[n] = p[n];
00575 
00576       return A;
00577     }
00578 
00579     scmatrix operator()(const intmatrix& P, const intmatrix& Q) {
00580       intvector p = permvec(P);
00581       intvector q = perminv(permvec(Q));
00582       return (*this)(p,q);
00583     }
00584 
00585     scmatrix operator()(const intmatrix& P) {
00586       intvector p = permvec(P);
00587       return (*this)(p);
00588     }
00589 
00590     real density() const {
00591       return p[n]/((double)m*n);
00592     }
00593 
00594     int get_nnz() const {
00595       return p[n];
00596     }
00597 
00598     scmatrix& operator+=(const rmatrix& B) {
00599       return spf_mm_addassign<scmatrix,rmatrix,cmatrix>(*this,B);
00600     }
00601 
00602     scmatrix& operator+=(const cmatrix& B) {
00603       return spf_mm_addassign<scmatrix,cmatrix,cmatrix>(*this,B);
00604     }
00605 
00606     scmatrix& operator+=(const rmatrix_slice& B) {
00607       return spf_mm_addassign<scmatrix,rmatrix_slice,cmatrix>(*this,B);
00608     }
00609 
00610     scmatrix& operator+=(const cmatrix_slice& B) {
00611       return spf_mm_addassign<scmatrix,cmatrix_slice,cmatrix>(*this,B);
00612     }
00613 
00614     scmatrix& operator+=(const srmatrix& B) {
00615       return spsp_mm_addassign<scmatrix,srmatrix,complex>(*this,B);
00616     }
00617 
00618     scmatrix& operator+=(const scmatrix& B) {
00619       return spsp_mm_addassign<scmatrix,scmatrix,complex>(*this,B);
00620     }
00621 
00622     scmatrix& operator-=(const rmatrix& B) {
00623       return spf_mm_subassign<scmatrix,rmatrix,cmatrix>(*this,B);
00624     }
00625 
00626     scmatrix& operator-=(const cmatrix& B) {
00627       return spf_mm_subassign<scmatrix,cmatrix,cmatrix>(*this,B);
00628     }
00629 
00630     scmatrix& operator-=(const rmatrix_slice& B) {
00631       return spf_mm_subassign<scmatrix,rmatrix_slice,cmatrix>(*this,B);
00632     }
00633 
00634     scmatrix& operator-=(const cmatrix_slice& B) {
00635       return spf_mm_subassign<scmatrix,cmatrix_slice,cmatrix>(*this,B);
00636     }
00637 
00638     scmatrix& operator-=(const srmatrix& B) {
00639       return spsp_mm_subassign<scmatrix,srmatrix,complex>(*this,B);
00640     }
00641 
00642     scmatrix& operator-=(const scmatrix& B) {
00643       return spsp_mm_subassign<scmatrix,scmatrix,complex>(*this,B);
00644     }
00645 
00646     scmatrix& operator*=(const cmatrix& B) {
00647       return spf_mm_multassign<scmatrix,cmatrix,sparse_cdot,cmatrix>(*this,B);
00648     }
00649 
00650     scmatrix& operator*=(const rmatrix& B) {
00651       return spf_mm_multassign<scmatrix,rmatrix,sparse_cdot,cmatrix>(*this,B);
00652     }
00653 
00654     scmatrix& operator*=(const rmatrix_slice& B) {
00655       return spf_mm_multassign<scmatrix,rmatrix_slice,sparse_cdot,cmatrix>(*this,B);
00656     }
00657 
00658     scmatrix& operator*=(const cmatrix_slice& B) {
00659       return spf_mm_multassign<scmatrix,cmatrix_slice,sparse_cdot,cmatrix>(*this,B);
00660     }
00661 
00662     scmatrix& operator*=(const srmatrix& B) {
00663       return spsp_mm_multassign<scmatrix,srmatrix,sparse_cdot,complex>(*this,B);
00664     }
00665 
00666     scmatrix& operator*=(const scmatrix& B) {
00667       return spsp_mm_multassign<scmatrix,scmatrix,sparse_cdot,complex>(*this,B);
00668     }
00669 
00670     scmatrix& operator*=(const real& r) {
00671       return sp_ms_multassign(*this,r);
00672     }
00673 
00674     scmatrix& operator*=(const complex& r) {
00675       return sp_ms_multassign(*this,r);
00676     }
00677 
00678     scmatrix& operator/=(const real& r) {
00679       return sp_ms_divassign(*this,r);
00680     }
00681 
00682     scmatrix& operator/=(const complex& r) {
00683       return sp_ms_divassign(*this,r);
00684     }
00685 
00686     friend void SetLb(scmatrix&, const int, const int);
00687     friend void SetUb(scmatrix&, const int, const int);    
00688     friend int Lb(const scmatrix&, int);
00689     friend int Ub(const scmatrix&, int);
00690     friend int RowLen(const scmatrix&);
00691     friend int ColLen(const scmatrix&);
00692     friend srmatrix Re(const scmatrix&);
00693     friend srmatrix Im(const scmatrix&);
00694     friend scmatrix Inf(const scimatrix&);
00695     friend scmatrix Sup(const scimatrix&);
00696     friend scmatrix mid(const scimatrix&);
00697     friend scmatrix diam(const scimatrix&);
00698 
00699     friend scmatrix transp(const scmatrix&);
00700     friend scmatrix Id(const scmatrix&);
00701 
00702     friend std::istream& operator>>(std::istream&, scmatrix_slice&);
00703     friend std::istream& operator>>(std::istream&, scmatrix_subv&);
00704 
00705     friend class srmatrix_slice;
00706     friend class srmatrix_subv;
00707     friend class srvector;
00708     friend class scmatrix_slice;
00709     friend class scmatrix_subv;
00710     friend class scvector;
00711     friend class scivector;
00712     friend class scimatrix;
00713     friend class scimatrix_slice;
00714     friend class scimatrix_subv;
00715     friend class cmatrix;
00716     friend class cimatrix;
00717 
00718 
00719 #include "matrix_friend_declarations.inl"
00720 };
00721 
00722 inline cmatrix::cmatrix(const srmatrix& A) {
00723   dat = new complex[A.m*A.n];
00724   lb1 = A.lb1; lb2 = A.lb2; ub1 = A.ub1; ub2 = A.ub2;
00725   xsize = A.n;
00726   ysize = A.m;
00727   *this = 0.0;
00728   for(int j=0 ; j<A.n ; j++) {
00729      for(int k=A.p[j] ; k<A.p[j+1] ; k++) {
00730         dat[A.ind[k]*A.n+j] = A.x[k];
00731      }
00732   }
00733 }
00734 
00735 inline cmatrix::cmatrix(const scmatrix& A) {
00736   dat = new complex[A.m*A.n];
00737   lb1 = A.lb1; lb2 = A.lb2; ub1 = A.ub1; ub2 = A.ub2;
00738   xsize = A.n;
00739   ysize = A.m;
00740   *this = 0.0;
00741   for(int j=0 ; j<A.n ; j++) {
00742      for(int k=A.p[j] ; k<A.p[j+1] ; k++) {
00743         dat[A.ind[k]*A.n+j] = A.x[k];
00744      }
00745   }
00746 }
00747 
00748 inline scmatrix Id(const scmatrix& A) {
00749   scmatrix I(A.m, A.n, (A.m>A.n) ? A.m : A.n);
00750   I.lb1 = A.lb1; I.lb2 = A.lb2;
00751   I.ub1 = A.ub1; I.ub2 = A.ub2;
00752 
00753   if(A.m < A.n) {
00754     for(int i=0 ; i<A.m ; i++) {
00755       I.p[i+1] = I.p[i] + 1;
00756       I.ind.push_back(i);
00757       I.x.push_back(complex(1.0));
00758     }
00759   } else {
00760     for(int i=0 ; i<A.n ; i++) {
00761       I.p[i+1] = I.p[i] + 1;
00762       I.ind.push_back(i);
00763       I.x.push_back(complex(1.0));
00764     }
00765   }
00766 
00767   return I;
00768 }
00769 
00770 inline scmatrix transp(const scmatrix& A) {
00771   scmatrix B(A.n, A.m, A.get_nnz());
00772     
00773   //Nichtnullen pro Zeile bestimmen
00774   std::vector<int> w(A.m,0);
00775   for(unsigned int i=0 ; i<A.ind.size() ; i++) 
00776     w[A.ind[i]]++;
00777 
00778   //Spalten"pointer" setzen
00779   B.p.resize(A.m+1);
00780   B.p[0] = 0;
00781   for(unsigned int i=1 ; i<B.p.size() ; i++)
00782     B.p[i] = w[i-1] + B.p[i-1];
00783 
00784   //w vorbereiten
00785   w.insert(w.begin(), 0); 
00786   for(unsigned int i=1 ; i<w.size() ; i++) {
00787     w[i] += w[i-1];
00788   }
00789 
00790   //neuer zeilenindex und wert wird gesetzt
00791   int q;
00792   B.ind.resize(A.get_nnz());
00793   B.x.resize(A.get_nnz());
00794   for(int j=0 ; j<A.n ; j++) {
00795     for(int k=A.p[j] ; k<A.p[j+1] ; k++) {
00796       q = w[A.ind[k]]++;
00797       B.ind[q] = j;
00798       B.x[q] = A.x[k];
00799     }
00800   }
00801 
00802   return B;
00803 }
00804 
00805 inline void SetLb(scmatrix& A, const int i, const int j) {
00806   if(i==1) {
00807     A.lb1 = j;
00808     A.ub1 = j + A.m - 1;
00809   } else if(i==2) {
00810     A.lb2 = j;
00811     A.ub2 = j + A.n - 1;
00812   }
00813 }
00814 
00815 inline void SetUb(scmatrix& A, const int i, const int j) {
00816   if(i==1) {
00817     A.ub1 = j;
00818     A.lb1 = j - A.m + 1;
00819   } else if(i==2) {
00820     A.ub2 = j;
00821     A.lb2 = j - A.n + 1;
00822   }
00823 }
00824 
00825 
00826 inline int Lb(const scmatrix& A, int i) {
00827   if(i==1) 
00828     return A.lb1;
00829   else if(i==2)
00830     return A.lb2;
00831   else
00832     return 1;
00833 }
00834 
00835 inline int Ub(const scmatrix& A, int i) {
00836   if(i==1) 
00837     return A.ub1;
00838   else if(i==2)
00839     return A.ub2;
00840   else
00841     return 1;
00842 }
00843 
00844 inline int RowLen(const scmatrix& A) {
00845   return A.n;
00846 }
00847 
00848 inline int ColLen(const scmatrix& A) {
00849   return A.m;
00850 }
00851 
00852 inline void Resize(scmatrix& A) {
00853   sp_m_resize(A);
00854 }
00855 
00856 inline void Resize(scmatrix& A, const int m, const int n) {
00857   sp_m_resize(A,m,n);
00858 }
00859 
00860 inline void Resize(scmatrix& A, const int l1, const int u1, const int l2, const int u2) {
00861   sp_m_resize(A,l1,u1,l2,u2);
00862 }
00863 
00864 inline srmatrix Re(const scmatrix& A) {
00865   srmatrix res(A.m,A.n,A.get_nnz());
00866   res.lb1 = A.lb1;
00867   res.lb2 = A.lb2;
00868   res.ub1 = A.ub1;
00869   res.ub2 = A.ub2;
00870   res.p   = A.p;
00871   res.ind = A.ind;
00872 
00873   for(int i=0 ; i<res.get_nnz() ; i++)
00874     res.x.push_back(Re(A.x[i]));
00875 
00876   res.dropzeros();
00877 
00878   return res; 
00879 }
00880 
00881 inline srmatrix Im(const scmatrix& A) {
00882   srmatrix res(A.m,A.n,A.get_nnz());
00883   res.lb1 = A.lb1;
00884   res.lb2 = A.lb2;
00885   res.ub1 = A.ub1;
00886   res.ub2 = A.ub2;
00887   res.p   = A.p;
00888   res.ind = A.ind;
00889 
00890   for(int i=0 ; i<res.get_nnz() ; i++)
00891     res.x.push_back(Im(A.x[i]));
00892 
00893   res.dropzeros();
00894 
00895   return res; 
00896 }
00897 
00898 
00899 inline cmatrix operator*(const cmatrix& A, const srmatrix& B) {
00900   return fsp_mm_mult<cmatrix,srmatrix,cmatrix,sparse_cdot>(A,B);
00901 }
00902 
00903 inline cmatrix operator*(const rmatrix& A, const scmatrix& B) {
00904   return fsp_mm_mult<rmatrix,scmatrix,cmatrix,sparse_cdot>(A,B);
00905 }
00906 
00907 inline cmatrix operator*(const cmatrix& A, const scmatrix& B) {
00908   return fsp_mm_mult<cmatrix,scmatrix,cmatrix,sparse_cdot>(A,B);
00909 }
00910 
00911 inline cmatrix operator*(const scmatrix& A, const rmatrix& B) {
00912   return spf_mm_mult<scmatrix,rmatrix,cmatrix,sparse_cdot>(A,B);
00913 }
00914 
00915 inline cmatrix operator*(const srmatrix& A, const cmatrix& B) {
00916   return spf_mm_mult<srmatrix,cmatrix,cmatrix,sparse_cdot>(A,B);
00917 }
00918 
00919 inline cmatrix operator*(const scmatrix& A, const cmatrix& B) {
00920   return spf_mm_mult<scmatrix,cmatrix,cmatrix,sparse_cdot>(A,B);
00921 }
00922 
00923 inline cmatrix operator*(const cmatrix_slice& A, const srmatrix& B) {
00924   return fsp_mm_mult<cmatrix_slice,srmatrix,cmatrix,sparse_cdot>(A,B);
00925 }
00926 
00927 inline cmatrix operator*(const rmatrix_slice& A, const scmatrix& B) {
00928   return fsp_mm_mult<rmatrix_slice,scmatrix,cmatrix,sparse_cdot>(A,B);
00929 }
00930 
00931 inline cmatrix operator*(const cmatrix_slice& A, const scmatrix& B) {
00932   return fsp_mm_mult<cmatrix_slice,scmatrix,cmatrix,sparse_cdot>(A,B);
00933 }
00934 
00935 inline cmatrix operator*(const scmatrix& A, const rmatrix_slice& B) {
00936   return spf_mm_mult<scmatrix,rmatrix_slice,cmatrix,sparse_cdot>(A,B);
00937 }
00938 
00939 inline cmatrix operator*(const srmatrix& A, const cmatrix_slice& B) {
00940   return spf_mm_mult<srmatrix,cmatrix_slice,cmatrix,sparse_cdot>(A,B);
00941 }
00942 
00943 inline cmatrix operator*(const scmatrix& A, const cmatrix_slice& B) {
00944   return spf_mm_mult<scmatrix,cmatrix_slice,cmatrix,sparse_cdot>(A,B);
00945 }
00946 
00947 inline scmatrix operator*(const scmatrix& A, const srmatrix& B) {
00948   return spsp_mm_mult<scmatrix,srmatrix,scmatrix,sparse_cdot,complex>(A,B);
00949 }
00950 
00951 inline scmatrix operator*(const srmatrix& A, const scmatrix& B) {
00952   return spsp_mm_mult<srmatrix,scmatrix,scmatrix,sparse_cdot,complex>(A,B);
00953 }
00954 
00955 inline scmatrix operator*(const scmatrix& A, const scmatrix& B) {
00956   return spsp_mm_mult<scmatrix,scmatrix,scmatrix,sparse_cdot,complex>(A,B);
00957 }
00958 
00959 inline scmatrix operator/(const scmatrix& A, const real& r) {
00960   return sp_ms_div<scmatrix,real,scmatrix>(A,r);
00961 }
00962 
00963 inline scmatrix operator/(const scmatrix& A, const complex& r) {
00964   return sp_ms_div<scmatrix,complex,scmatrix>(A,r);
00965 }
00966 
00967 inline scmatrix operator/(const srmatrix& A, const complex& r) {
00968   return sp_ms_div<srmatrix,complex,scmatrix>(A,r);
00969 }
00970 
00971 inline scmatrix operator*(const scmatrix& A, const real& r) {
00972   return sp_ms_mult<scmatrix,real,scmatrix>(A,r);
00973 }
00974 
00975 inline scmatrix operator*(const scmatrix& A, const complex& r) {
00976   return sp_ms_mult<scmatrix,complex,scmatrix>(A,r);
00977 }
00978 
00979 inline scmatrix operator*(const srmatrix& A, const complex& r) {
00980   return sp_ms_mult<srmatrix,complex,scmatrix>(A,r);
00981 }
00982 
00983 inline scmatrix operator*(const real& r, const scmatrix& A) {
00984   return sp_sm_mult<real,scmatrix,scmatrix>(r,A);
00985 }
00986 
00987 inline scmatrix operator*(const complex& r, const scmatrix& A) {
00988   return sp_sm_mult<complex,scmatrix,scmatrix>(r,A);
00989 }
00990 
00991 inline scmatrix operator*(const complex& r, const srmatrix& A) {
00992   return sp_sm_mult<complex,srmatrix,scmatrix>(r,A);
00993 }
00994 
00995 inline cvector operator*(const scmatrix& A, const rvector& v) {
00996   return spf_mv_mult<scmatrix,rvector,cvector,sparse_cdot>(A,v);
00997 }
00998 
00999 inline cvector operator*(const srmatrix& A, const cvector& v) {
01000   return spf_mv_mult<srmatrix,cvector,cvector,sparse_cdot>(A,v);
01001 }
01002 
01003 inline cvector operator*(const scmatrix& A, const cvector& v) {
01004   return spf_mv_mult<scmatrix,cvector,cvector,sparse_cdot>(A,v);
01005 }
01006 
01007 inline cvector operator*(const scmatrix& A, const rvector_slice& v) {
01008   return spf_mv_mult<scmatrix,rvector_slice,cvector,sparse_cdot>(A,v);
01009 }
01010 
01011 inline cvector operator*(const srmatrix& A, const cvector_slice& v) {
01012   return spf_mv_mult<srmatrix,cvector_slice,cvector,sparse_cdot>(A,v);
01013 }
01014 
01015 inline cvector operator*(const scmatrix& A, const cvector_slice& v) {
01016   return spf_mv_mult<scmatrix,cvector_slice,cvector,sparse_cdot>(A,v);
01017 }
01018 
01019 inline scvector operator*(const scmatrix& A, const srvector& v) {
01020   return spsp_mv_mult<scmatrix,srvector,scvector,sparse_cdot,complex>(A,v);
01021 }
01022 
01023 inline scvector operator*(const srmatrix& A, const scvector& v) {
01024   return spsp_mv_mult<srmatrix,scvector,scvector,sparse_cdot,complex>(A,v);
01025 }
01026 
01027 inline scvector operator*(const scmatrix& A, const scvector& v) {
01028   return spsp_mv_mult<scmatrix,scvector,scvector,sparse_cdot,complex>(A,v);
01029 }
01030 
01031 inline scvector operator*(const scmatrix& A, const srvector_slice& v) {
01032   return spsl_mv_mult<scmatrix,srvector_slice,scvector,sparse_cdot,complex>(A,v);
01033 }
01034 
01035 inline scvector operator*(const srmatrix& A, const scvector_slice& v) {
01036   return spsl_mv_mult<srmatrix,scvector_slice,scvector,sparse_cdot,complex>(A,v);
01037 }
01038 
01039 inline scvector operator*(const scmatrix& A, const scvector_slice& v) {
01040   return spsl_mv_mult<scmatrix,scvector_slice,scvector,sparse_cdot,complex>(A,v);
01041 }
01042 
01043 inline cvector operator*(const cmatrix& A, const srvector& v) {
01044   return fsp_mv_mult<cmatrix,srvector,cvector,sparse_cdot>(A,v);
01045 }
01046 
01047 inline cvector operator*(const rmatrix& A, const scvector& v) {
01048   return fsp_mv_mult<rmatrix,scvector,cvector,sparse_cdot>(A,v);
01049 }
01050 
01051 inline cvector operator*(const cmatrix& A, const scvector& v) {
01052   return fsp_mv_mult<cmatrix,scvector,cvector,sparse_cdot>(A,v);
01053 }
01054 
01055 inline cvector operator*(const cmatrix_slice& A, const srvector& v) {
01056   return fsp_mv_mult<cmatrix_slice,srvector,cvector,sparse_cdot>(A,v);
01057 }
01058 
01059 inline cvector operator*(const rmatrix_slice& A, const scvector& v) {
01060   return fsp_mv_mult<rmatrix_slice,scvector,cvector,sparse_cdot>(A,v);
01061 }
01062 
01063 inline cvector operator*(const cmatrix_slice& A, const scvector& v) {
01064   return fsp_mv_mult<cmatrix_slice,scvector,cvector,sparse_cdot>(A,v);
01065 }
01066 
01067 inline cvector operator*(const cmatrix& A, const srvector_slice& v) {
01068   return fsl_mv_mult<cmatrix,srvector_slice,cvector,sparse_cdot>(A,v);
01069 }
01070 
01071 inline cvector operator*(const rmatrix& A, const scvector_slice& v) {
01072   return fsl_mv_mult<rmatrix,scvector_slice,cvector,sparse_cdot>(A,v);
01073 }
01074 
01075 inline cvector operator*(const cmatrix& A, const scvector_slice& v) {
01076   return fsl_mv_mult<cmatrix,scvector_slice,cvector,sparse_cdot>(A,v);
01077 }
01078 
01079 inline cvector operator*(const cmatrix_slice& A, const srvector_slice& v) {
01080   return fsl_mv_mult<cmatrix_slice,srvector_slice,cvector,sparse_cdot>(A,v);
01081 }
01082 
01083 inline cvector operator*(const rmatrix_slice& A, const scvector_slice& v) {
01084   return fsl_mv_mult<rmatrix_slice,scvector_slice,cvector,sparse_cdot>(A,v);
01085 }
01086 
01087 inline cvector operator*(const cmatrix_slice& A, const scvector_slice& v) {
01088   return fsl_mv_mult<cmatrix_slice,scvector_slice,cvector,sparse_cdot>(A,v);
01089 }
01090 
01091 inline cmatrix operator+(const cmatrix& A, const srmatrix& B) {
01092   return fsp_mm_add<cmatrix,srmatrix,cmatrix>(A,B);
01093 }
01094 
01095 inline cmatrix operator+(const rmatrix& A, const scmatrix& B) {
01096   return fsp_mm_add<rmatrix,scmatrix,cmatrix>(A,B);
01097 }
01098 
01099 inline cmatrix operator+(const cmatrix& A, const scmatrix& B) {
01100   return fsp_mm_add<cmatrix,scmatrix,cmatrix>(A,B);
01101 }
01102 
01103 inline cmatrix operator+(const scmatrix& A, const rmatrix& B) {
01104   return spf_mm_add<scmatrix,rmatrix,cmatrix>(A,B);
01105 }
01106 
01107 inline cmatrix operator+(const srmatrix& A, const cmatrix& B) {
01108   return spf_mm_add<srmatrix,cmatrix,cmatrix>(A,B);
01109 }
01110 
01111 inline cmatrix operator+(const scmatrix& A, const cmatrix& B) {
01112   return spf_mm_add<scmatrix,cmatrix,cmatrix>(A,B);
01113 }
01114 
01115 inline cmatrix operator+(const cmatrix_slice& A, const srmatrix& B) {
01116   return fsp_mm_add<cmatrix_slice,srmatrix,cmatrix>(A,B);
01117 }
01118 
01119 inline cmatrix operator+(const rmatrix_slice& A, const scmatrix& B) {
01120   return fsp_mm_add<rmatrix_slice,scmatrix,cmatrix>(A,B);
01121 }
01122 
01123 inline cmatrix operator+(const cmatrix_slice& A, const scmatrix& B) {
01124   return fsp_mm_add<cmatrix_slice,scmatrix,cmatrix>(A,B);
01125 }
01126 
01127 inline cmatrix operator+(const scmatrix& A, const rmatrix_slice& B) {
01128   return spf_mm_add<scmatrix,rmatrix_slice,cmatrix>(A,B);
01129 }
01130 
01131 inline cmatrix operator+(const srmatrix& A, const cmatrix_slice& B) {
01132   return spf_mm_add<srmatrix,cmatrix_slice,cmatrix>(A,B);
01133 }
01134 
01135 inline cmatrix operator+(const scmatrix& A, const cmatrix_slice& B) {
01136   return spf_mm_add<scmatrix,cmatrix_slice,cmatrix>(A,B);
01137 }
01138 
01139 inline scmatrix operator+(const scmatrix& A, const srmatrix& B) {
01140   return spsp_mm_add<scmatrix,srmatrix,scmatrix,complex>(A,B);
01141 }
01142 
01143 inline scmatrix operator+(const srmatrix& A, const scmatrix& B) {
01144   return spsp_mm_add<srmatrix,scmatrix,scmatrix,complex>(A,B);
01145 }
01146 
01147 inline scmatrix operator+(const scmatrix& A, const scmatrix& B) {
01148   return spsp_mm_add<scmatrix,scmatrix,scmatrix,complex>(A,B);
01149 }
01150 
01151 inline cmatrix operator-(const cmatrix& A, const srmatrix& B) {
01152   return fsp_mm_sub<cmatrix,srmatrix,cmatrix>(A,B);
01153 }
01154 
01155 inline cmatrix operator-(const rmatrix& A, const scmatrix& B) {
01156   return fsp_mm_sub<rmatrix,scmatrix,cmatrix>(A,B);
01157 }
01158 
01159 inline cmatrix operator-(const cmatrix& A, const scmatrix& B) {
01160   return fsp_mm_sub<cmatrix,scmatrix,cmatrix>(A,B);
01161 }
01162 
01163 inline cmatrix operator-(const scmatrix& A, const rmatrix& B) {
01164   return spf_mm_sub<scmatrix,rmatrix,cmatrix>(A,B);
01165 }
01166 
01167 inline cmatrix operator-(const srmatrix& A, const cmatrix& B) {
01168   return spf_mm_sub<srmatrix,cmatrix,cmatrix>(A,B);
01169 }
01170 
01171 inline cmatrix operator-(const scmatrix& A, const cmatrix& B) {
01172   return spf_mm_sub<scmatrix,cmatrix,cmatrix>(A,B);
01173 }
01174 
01175 inline cmatrix operator-(const cmatrix_slice& A, const srmatrix& B) {
01176   return fsp_mm_sub<cmatrix_slice,srmatrix,cmatrix>(A,B);
01177 }
01178 
01179 inline cmatrix operator-(const rmatrix_slice& A, const scmatrix& B) {
01180   return fsp_mm_sub<rmatrix_slice,scmatrix,cmatrix>(A,B);
01181 }
01182 
01183 inline cmatrix operator-(const cmatrix_slice& A, const scmatrix& B) {
01184   return fsp_mm_sub<cmatrix_slice,scmatrix,cmatrix>(A,B);
01185 }
01186 
01187 inline cmatrix operator-(const scmatrix& A, const rmatrix_slice& B) {
01188   return spf_mm_sub<scmatrix,rmatrix_slice,cmatrix>(A,B);
01189 }
01190 
01191 inline cmatrix operator-(const srmatrix& A, const cmatrix_slice& B) {
01192   return spf_mm_sub<srmatrix,cmatrix_slice,cmatrix>(A,B);
01193 }
01194 
01195 inline cmatrix operator-(const scmatrix& A, const cmatrix_slice& B) {
01196   return spf_mm_sub<scmatrix,cmatrix_slice,cmatrix>(A,B);
01197 }
01198 
01199 inline scmatrix operator-(const scmatrix& A, const srmatrix& B) {
01200   return spsp_mm_sub<scmatrix,srmatrix,scmatrix,complex>(A,B);
01201 }
01202 
01203 inline scmatrix operator-(const srmatrix& A, const scmatrix& B) {
01204   return spsp_mm_sub<srmatrix,scmatrix,scmatrix,complex>(A,B);
01205 }
01206 
01207 inline scmatrix operator-(const scmatrix& A, const scmatrix& B) {
01208   return spsp_mm_sub<scmatrix,scmatrix,scmatrix,complex>(A,B);
01209 }
01210 
01211 inline scmatrix operator-(const scmatrix& M) {
01212   return sp_m_negative<scmatrix,scmatrix>(M);
01213 }
01214 
01215 inline scmatrix& operator+(scmatrix& A) {
01216   return A;
01217 }
01218 
01219 inline cmatrix& cmatrix::operator=(const srmatrix& B) {
01220   *this = rmatrix(B);
01221   return *this;
01222 }
01223 
01224 inline cmatrix_slice& cmatrix_slice::operator=(const srmatrix& B) {
01225   *this = rmatrix(B);
01226   return *this;
01227 }
01228 
01229 inline cmatrix& cmatrix::operator=(const scmatrix& B) {
01230   *this = cmatrix(B);
01231   return *this;
01232 }
01233 
01234 inline cmatrix_slice& cmatrix_slice::operator=(const scmatrix& B) {
01235   *this = cmatrix(B);
01236   return *this;
01237 }
01238 
01239 inline cmatrix& cmatrix::operator+=(const srmatrix& B) {
01240   return fsp_mm_addassign(*this,B);
01241 }
01242 
01243 inline cmatrix& cmatrix::operator+=(const scmatrix& B) {
01244   return fsp_mm_addassign(*this,B);
01245 }
01246 
01247 inline cmatrix_slice& cmatrix_slice::operator+=(const srmatrix& B) {
01248   return fsp_mm_addassign(*this,B);
01249 }
01250 
01251 inline cmatrix_slice& cmatrix_slice::operator+=(const scmatrix& B) {
01252   return fsp_mm_addassign(*this,B);
01253 }
01254 
01255 inline cmatrix& cmatrix::operator-=(const srmatrix& B) {
01256   return fsp_mm_subassign(*this,B);
01257 }
01258 
01259 inline cmatrix& cmatrix::operator-=(const scmatrix& B) {
01260   return fsp_mm_subassign(*this,B);
01261 }
01262 
01263 inline cmatrix_slice& cmatrix_slice::operator-=(const srmatrix& B) {
01264   return fsp_mm_subassign(*this,B);
01265 }
01266 
01267 inline cmatrix_slice& cmatrix_slice::operator-=(const scmatrix& B) {
01268   return fsp_mm_subassign(*this,B);
01269 }
01270 
01271 inline cmatrix& cmatrix::operator*=(const srmatrix& B) {
01272   return fsp_mm_multassign<cmatrix,srmatrix,sparse_cdot,cmatrix>(*this,B);
01273 }
01274 
01275 inline cmatrix& cmatrix::operator*=(const scmatrix& B) {
01276   return fsp_mm_multassign<cmatrix,scmatrix,sparse_cdot,cmatrix>(*this,B);
01277 }
01278 
01279 inline cmatrix_slice& cmatrix_slice::operator*=(const srmatrix& B) {
01280   return fsp_mm_multassign<cmatrix_slice,srmatrix,sparse_cdot,cmatrix>(*this,B);
01281 }
01282 
01283 inline cmatrix_slice& cmatrix_slice::operator*=(const scmatrix& B) {
01284   return fsp_mm_multassign<cmatrix_slice,scmatrix,sparse_cdot,cmatrix>(*this,B);
01285 }
01286 
01287 inline bool operator==(const scmatrix& A, const srmatrix& B) {
01288   return spsp_mm_comp(A,B);
01289 }
01290 
01291 inline bool operator==(const srmatrix& A, const scmatrix& B) {
01292   return spsp_mm_comp(A,B);
01293 }
01294 
01295 inline bool operator==(const scmatrix& A, const scmatrix& B) {
01296   return spsp_mm_comp(A,B);
01297 }
01298 
01299 inline bool operator==(const scmatrix& A, const rmatrix& B) {
01300   return spf_mm_comp(A,B);
01301 }
01302 
01303 inline bool operator==(const srmatrix& A, const cmatrix& B) {
01304   return spf_mm_comp(A,B);
01305 }
01306 
01307 inline bool operator==(const scmatrix& A, const cmatrix& B) {
01308   return spf_mm_comp(A,B);
01309 }
01310 
01311 inline bool operator==(const cmatrix& A, const srmatrix& B) {
01312   return fsp_mm_comp(A,B);
01313 }
01314 
01315 inline bool operator==(const rmatrix& A, const scmatrix& B) {
01316   return fsp_mm_comp(A,B);
01317 }
01318 
01319 inline bool operator==(const cmatrix& A, const scmatrix& B) {
01320   return fsp_mm_comp(A,B);
01321 }
01322 
01323 inline bool operator==(const cmatrix_slice& A, const srmatrix& B) {
01324   return fsp_mm_comp(A,B);
01325 }
01326 
01327 inline bool operator==(const rmatrix_slice& A, const scmatrix& B) {
01328   return fsp_mm_comp(A,B);
01329 }
01330 
01331 inline bool operator==(const cmatrix_slice& A, const scmatrix& B) {
01332   return fsp_mm_comp(A,B);
01333 }
01334 
01335 inline bool operator==(const scmatrix& A, const rmatrix_slice& B) {
01336   return spf_mm_comp(A,B);
01337 }
01338 
01339 inline bool operator==(const srmatrix& A, const cmatrix_slice& B) {
01340   return spf_mm_comp(A,B);
01341 }
01342 
01343 inline bool operator==(const scmatrix& A, const cmatrix_slice& B) {
01344   return spf_mm_comp(A,B);
01345 }
01346 
01347 inline bool operator!=(const scmatrix& A, const srmatrix& B) {
01348   return !spsp_mm_comp(A,B);
01349 }
01350 
01351 inline bool operator!=(const srmatrix& A, const scmatrix& B) {
01352   return !spsp_mm_comp(A,B);
01353 }
01354 
01355 inline bool operator!=(const scmatrix& A, const scmatrix& B) {
01356   return !spsp_mm_comp(A,B);
01357 }
01358 
01359 inline bool operator!=(const scmatrix& A, const rmatrix& B) {
01360   return !spf_mm_comp(A,B);
01361 }
01362 
01363 inline bool operator!=(const srmatrix& A, const cmatrix& B) {
01364   return !spf_mm_comp(A,B);
01365 }
01366 
01367 inline bool operator!=(const scmatrix& A, const cmatrix& B) {
01368   return !spf_mm_comp(A,B);
01369 }
01370 
01371 inline bool operator!=(const cmatrix& A, const srmatrix& B) {
01372   return !fsp_mm_comp(A,B);
01373 }
01374 
01375 inline bool operator!=(const rmatrix& A, const scmatrix& B) {
01376   return !fsp_mm_comp(A,B);
01377 }
01378 
01379 inline bool operator!=(const cmatrix& A, const scmatrix& B) {
01380   return !fsp_mm_comp(A,B);
01381 }
01382 
01383 inline bool operator!=(const cmatrix_slice& A, const srmatrix& B) {
01384   return !fsp_mm_comp(A,B);
01385 }
01386 
01387 inline bool operator!=(const rmatrix_slice& A, const scmatrix& B) {
01388   return !fsp_mm_comp(A,B);
01389 }
01390 
01391 inline bool operator!=(const cmatrix_slice& A, const scmatrix& B) {
01392   return !fsp_mm_comp(A,B);
01393 }
01394 
01395 inline bool operator!=(const scmatrix& A, const rmatrix_slice& B) {
01396   return !spf_mm_comp(A,B);
01397 }
01398 
01399 inline bool operator!=(const srmatrix& A, const cmatrix_slice& B) {
01400   return !spf_mm_comp(A,B);
01401 }
01402 
01403 inline bool operator!=(const scmatrix& A, const cmatrix_slice& B) {
01404   return !spf_mm_comp(A,B);
01405 }
01406 
01407 inline bool operator!(const scmatrix& A) {
01408   return sp_m_not(A);
01409 }
01410 
01411 inline std::ostream& operator<<(std::ostream& os, const scmatrix& A) {
01412   return sp_m_output<scmatrix,complex>(os,A);
01413 }
01414 
01415 inline std::istream& operator>>(std::istream& is, scmatrix& A) {
01416   return sp_m_input<scmatrix,complex>(is,A);
01417 }
01418 
01419 class scmatrix_slice {
01420   public:
01421     scmatrix  A;
01422     scmatrix* M; //Originalmatrix
01423 
01424   private:
01425     scmatrix_slice(scmatrix& Mat, int sl1l, int sl1u, int sl2l, int sl2u) {    
01426         A.lb1 = sl1l;
01427         A.lb2 = sl2l;
01428         A.ub1 = sl1u;
01429         A.ub2 = sl2u;
01430         A.m   = sl1u-sl1l+1;
01431         A.n   = sl2u-sl2l+1;
01432  
01433         //Kopieren der Werte aus A
01434         A.p = std::vector<int>(A.n+1, 0);
01435         A.ind.reserve(A.m + A.n);
01436         A.x.reserve(A.m + A.n);
01437 
01438         for(int i=0 ; i<A.n ; i++) {
01439            A.p[i+1] = A.p[i];
01440            for(int j=Mat.p[sl2l-Mat.lb2+i] ; j<Mat.p[sl2l-Mat.lb2+i+1] ; j++) {
01441               if(Mat.ind[j] >= sl1l-Mat.lb1  &&  Mat.ind[j] <= sl1u-Mat.lb1) {
01442                 A.ind.push_back(Mat.ind[j]-(sl1l-Mat.lb1));
01443                 A.x.push_back(Mat.x[j]);
01444                 A.p[i+1]++;
01445              }
01446            }
01447         }
01448 
01449         //Zeiger auf A fuer Datenmanipulationen
01450         M = &Mat;
01451     }
01452 
01453     scmatrix_slice(const scmatrix& Mat, int sl1l, int sl1u, int sl2l, int sl2u) {    
01454         A.lb1 = sl1l;
01455         A.lb2 = sl2l;
01456         A.ub1 = sl1u;
01457         A.ub2 = sl2u;
01458         A.m   = sl1u-sl1l+1;
01459         A.n   = sl2u-sl2l+1;
01460  
01461         //Kopieren der Werte aus A
01462         A.p = std::vector<int>(A.n+1, 0);
01463         A.ind.reserve(A.m + A.n);
01464         A.x.reserve(A.m + A.n);
01465 
01466         for(int i=0 ; i<A.n ; i++) {
01467            A.p[i+1] = A.p[i];
01468            for(int j=Mat.p[sl2l-Mat.lb2+i] ; j<Mat.p[sl2l-Mat.lb2+i+1] ; j++) {
01469               if(Mat.ind[j] >= sl1l-Mat.lb1  &&  Mat.ind[j] <= sl1u-Mat.lb1) {
01470                 A.ind.push_back(Mat.ind[j]-(sl1l-Mat.lb1));
01471                 A.x.push_back(Mat.x[j]);
01472                 A.p[i+1]++;
01473              }
01474            }
01475         }
01476 
01477         //Zeiger auf A fuer Datenmanipulationen
01478         M = const_cast<scmatrix*>(&Mat);
01479     }
01480 
01481   public:
01482     scmatrix_slice& operator=(const real& C) {
01483       return sl_ms_assign<scmatrix_slice, real, std::vector<complex>::iterator, complex>(*this,C);
01484     }
01485 
01486     scmatrix_slice& operator=(const complex& C) {
01487       return sl_ms_assign<scmatrix_slice, complex, std::vector<complex>::iterator, complex>(*this,C);
01488     }
01489 
01490     scmatrix_slice& operator=(const srmatrix& C) {
01491       return slsp_mm_assign<scmatrix_slice, srmatrix, std::vector<complex>::iterator>(*this,C);
01492     }
01493 
01494     scmatrix_slice& operator=(const scmatrix& C) {
01495       return slsp_mm_assign<scmatrix_slice, scmatrix, std::vector<complex>::iterator>(*this,C);
01496     }
01497 
01498     scmatrix_slice& operator=(const rmatrix& C) {
01499       return slf_mm_assign<scmatrix_slice, rmatrix, std::vector<complex>::iterator, complex>(*this,C);
01500     }
01501 
01502     scmatrix_slice& operator=(const cmatrix& C) {
01503       return slf_mm_assign<scmatrix_slice, cmatrix, std::vector<complex>::iterator, complex>(*this,C);
01504     }
01505 
01506     scmatrix_slice& operator=(const rmatrix_slice& C) {
01507       return slf_mm_assign<scmatrix_slice, rmatrix_slice, std::vector<complex>::iterator, complex>(*this,C);
01508     }
01509 
01510     scmatrix_slice& operator=(const cmatrix_slice& C) {
01511       return slf_mm_assign<scmatrix_slice, cmatrix_slice, std::vector<complex>::iterator, complex>(*this,C);
01512     }
01513 
01514     scmatrix_slice& operator=(const srmatrix_slice& C) {
01515       *this = C.A;
01516       return *this;
01517     }
01518 
01519     scmatrix_slice& operator=(const scmatrix_slice& C) {
01520       *this = C.A;
01521       return *this;
01522     }
01523 
01524     scmatrix_slice& operator*=(const srmatrix_slice& M) {
01525       *this = A*M.A;
01526       return *this;
01527     }
01528 
01529     scmatrix_slice& operator*=(const scmatrix_slice& M) {
01530       *this = A*M.A;
01531       return *this;
01532     }
01533 
01534     scmatrix_slice& operator*=(const srmatrix& M) {
01535       *this = A*M;
01536       return *this;
01537     }
01538 
01539     scmatrix_slice& operator*=(const scmatrix& M) {
01540       *this = A*M;
01541       return *this;
01542     }
01543 
01544     scmatrix_slice& operator*=(const rmatrix& M) {
01545       *this = A*M;
01546       return *this;
01547     }
01548 
01549     scmatrix_slice& operator*=(const cmatrix& M) {
01550       *this = A*M;
01551       return *this;
01552     }
01553 
01554     scmatrix_slice& operator*=(const rmatrix_slice& M) {
01555       *this = A*M;
01556       return *this;
01557     }
01558 
01559     scmatrix_slice& operator*=(const cmatrix_slice& M) {
01560       *this = A*M;
01561       return *this;
01562     }
01563 
01564     scmatrix_slice& operator*=(const real& r) {
01565       *this = A*r;
01566       return *this;
01567     }
01568 
01569     scmatrix_slice& operator*=(const complex& r) {
01570       *this = A*r;
01571       return *this;
01572     }
01573 
01574     scmatrix_slice& operator/=(const real& r) {
01575       *this = A/r;
01576       return *this;
01577     }
01578 
01579     scmatrix_slice& operator/=(const complex& r) {
01580       *this = A/r;
01581       return *this;
01582     }
01583 
01584     scmatrix_slice& operator+=(const srmatrix_slice& M) {
01585       *this = A+M.A;
01586       return *this;
01587     } 
01588 
01589     scmatrix_slice& operator+=(const scmatrix_slice& M) {
01590       *this = A+M.A;
01591       return *this;
01592     } 
01593 
01594     scmatrix_slice& operator+=(const srmatrix& M) {
01595       *this = A+M;
01596       return *this;
01597     } 
01598 
01599     scmatrix_slice& operator+=(const scmatrix& M) {
01600       *this = A+M;
01601       return *this;
01602     } 
01603 
01604     scmatrix_slice& operator+=(const rmatrix& M) {
01605       *this = A+M;
01606       return *this;
01607     } 
01608 
01609     scmatrix_slice& operator+=(const cmatrix& M) {
01610       *this = A+M;
01611       return *this;
01612     } 
01613 
01614     scmatrix_slice& operator+=(const rmatrix_slice& M) {
01615       *this = A+M;
01616       return *this;
01617     } 
01618 
01619     scmatrix_slice& operator+=(const cmatrix_slice& M) {
01620       *this = A+M;
01621       return *this;
01622     } 
01623 
01624     scmatrix_slice& operator-=(const srmatrix_slice& M) {
01625       *this = A-M.A;
01626       return *this;
01627     } 
01628 
01629     scmatrix_slice& operator-=(const scmatrix_slice& M) {
01630       *this = A-M.A;
01631       return *this;
01632     } 
01633 
01634     scmatrix_slice& operator-=(const srmatrix& M) {
01635       *this = A-M;
01636       return *this;
01637     } 
01638 
01639     scmatrix_slice& operator-=(const scmatrix& M) {
01640       *this = A-M;
01641       return *this;
01642     } 
01643 
01644     scmatrix_slice& operator-=(const rmatrix& M) {
01645       *this = A-M;
01646       return *this;
01647     } 
01648 
01649     scmatrix_slice& operator-=(const cmatrix& M) {
01650       *this = A-M;
01651       return *this;
01652     } 
01653 
01654     scmatrix_slice& operator-=(const rmatrix_slice& M) {
01655       *this = A-M;
01656       return *this;
01657     }
01658 
01659     scmatrix_slice& operator-=(const cmatrix_slice& M) {
01660       *this = A-M;
01661       return *this;
01662     }
01663 
01664     const complex operator()(const int i, const int j) const {
01665 #if(CXSC_INDEX_CHECK)
01666       if(i<A.lb1 || i>A.ub1 || j<A.lb2 || j>A.ub2)
01667         cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_slice::operator()(int, int)"));
01668 #endif
01669       complex r = A(i,j);
01670       return r;
01671     }
01672 
01673     complex& element(const int i, const int j) {
01674 #if(CXSC_INDEX_CHECK)
01675       if(i<A.lb1 || i>A.ub1 || j<A.lb2 || j>A.ub2)
01676         cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_slice::element(int, int)"));
01677 #endif
01678       return M->element(i,j);
01679     }
01680 
01681     scmatrix_subv operator[](const int);
01682     scmatrix_subv operator[](const cxscmatrix_column&);
01683     const scmatrix_subv operator[](const int) const;
01684     const scmatrix_subv operator[](const cxscmatrix_column&) const;
01685 
01686     friend std::ostream& operator<<(std::ostream&, const scmatrix_slice&);
01687     friend std::istream& operator>>(std::istream&, const scmatrix_subv&);
01688 
01689     friend int Lb(const scmatrix_slice&, const int);
01690     friend int Ub(const scmatrix_slice&, const int);
01691     friend srmatrix Re(const scmatrix_slice&);
01692     friend srmatrix Im(const scmatrix_slice&);
01693     friend int RowLen(const scmatrix_slice&);
01694     friend int ColLen(const scmatrix_slice&);
01695 
01696     friend class srmatrix;
01697     friend class srmatrix_subv;
01698     friend class srvector;
01699     friend class scmatrix;
01700     friend class scmatrix_subv;
01701     friend class scvector;
01702     friend class scimatrix;
01703     friend class scimatrix_subv;
01704     friend class scimatrix_slice;
01705     friend class scivector;
01706     friend class cmatrix;
01707     friend class cimatrix;
01708 
01709 #include "matrix_friend_declarations.inl"    
01710 };
01711 
01712 inline cmatrix::cmatrix(const srmatrix_slice& A) {
01713   dat = new complex[A.A.m*A.A.n];
01714   lb1 = A.A.lb1; lb2 = A.A.lb2; ub1 = A.A.ub1; ub2 = A.A.ub2;
01715   xsize = A.A.n;
01716   ysize = A.A.m;
01717   *this = 0.0;
01718   for(int j=0 ; j<A.A.n ; j++) {
01719      for(int k=A.A.p[j] ; k<A.A.p[j+1] ; k++) {
01720         dat[A.A.ind[k]*A.A.n+j] = A.A.x[k];
01721      }
01722   }
01723 }
01724 
01725 inline cmatrix::cmatrix(const scmatrix_slice& A) {
01726   dat = new complex[A.A.m*A.A.n];
01727   lb1 = A.A.lb1; lb2 = A.A.lb2; ub1 = A.A.ub1; ub2 = A.A.ub2;
01728   xsize = A.A.n;
01729   ysize = A.A.m;
01730   *this = 0.0;
01731   for(int j=0 ; j<A.A.n ; j++) {
01732      for(int k=A.A.p[j] ; k<A.A.p[j+1] ; k++) {
01733         dat[A.A.ind[k]*A.A.n+j] = A.A.x[k];
01734      }
01735   }
01736 }
01737 
01738 inline int RowLen(const scmatrix_slice& S) {
01739   return RowLen(S.A);
01740 }
01741 
01742 inline int ColLen(const scmatrix_slice& S) {
01743   return ColLen(S.A);
01744 }
01745 
01746 inline scmatrix_slice scmatrix::operator()(const int i, const int j, const int k, const int l) {
01747 #if(CXSC_INDEX_CHECK)
01748   if(i<lb1 || j>ub1 || k<lb2 || l>ub2)
01749     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator()(int, int)"));
01750 #endif
01751   return scmatrix_slice(*this, i, j, k, l);
01752 }
01753 
01754 inline scmatrix& scmatrix::operator=(const srmatrix_slice& S) {
01755   *this = S.A;
01756   return *this;
01757 }
01758 
01759 inline scmatrix& scmatrix::operator=(const scmatrix_slice& S) {
01760   *this = S.A;
01761   return *this;
01762 }
01763 
01764 inline int Lb(const scmatrix_slice& S, const int i) {
01765   return Lb(S.A, i);
01766 }
01767 
01768 inline int Ub(const scmatrix_slice& S, const int i) {
01769   return Ub(S.A, i);
01770 }
01771 
01772 inline srmatrix Re(const scmatrix_slice& S) {
01773   return Re(S.A);
01774 }
01775 
01776 inline srmatrix Im(const scmatrix_slice& S) {
01777   return Im(S.A);
01778 }
01779 
01780 inline scmatrix::scmatrix(const srmatrix_slice& S) {
01781   m = S.A.m;
01782   n = S.A.n;
01783   lb1 = S.A.lb1;
01784   ub1 = S.A.ub1;
01785   lb2 = S.A.lb2;
01786   ub2 = S.A.ub2;
01787   *this = S.A;
01788 }
01789 
01790 inline scmatrix::scmatrix(const scmatrix_slice& S) {
01791   m = S.A.m;
01792   n = S.A.n;
01793   lb1 = S.A.lb1;
01794   ub1 = S.A.ub1;
01795   lb2 = S.A.lb2;
01796   ub2 = S.A.ub2;
01797   *this = S.A;
01798 }
01799 
01800 inline scmatrix operator-(const scmatrix_slice& M) {
01801   return sp_m_negative<scmatrix,scmatrix>(M.A);
01802 }
01803 
01804 inline scmatrix operator+(const scmatrix_slice& M) {
01805   return M.A;
01806 }
01807 
01808 inline scmatrix operator*(const scmatrix_slice& M1, const srmatrix_slice& M2) {
01809   return spsp_mm_mult<scmatrix,srmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2.A);
01810 }
01811 
01812 inline scmatrix operator*(const srmatrix_slice& M1, const scmatrix_slice& M2) {
01813   return spsp_mm_mult<srmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2.A);
01814 }
01815 
01816 inline scmatrix operator*(const scmatrix_slice& M1, const scmatrix_slice& M2) {
01817   return spsp_mm_mult<scmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2.A);
01818 }
01819 
01820 inline scmatrix operator*(const scmatrix_slice& M1, const srmatrix& M2) {
01821   return spsp_mm_mult<scmatrix,srmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2);
01822 }
01823 
01824 inline scmatrix operator*(const srmatrix_slice& M1, const scmatrix& M2) {
01825   return spsp_mm_mult<srmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2);
01826 }
01827 
01828 inline scmatrix operator*(const scmatrix_slice& M1, const scmatrix& M2) {
01829   return spsp_mm_mult<scmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2);
01830 }
01831 
01832 inline scmatrix operator*(const scmatrix& M1, const srmatrix_slice& M2) {
01833   return spsp_mm_mult<scmatrix,srmatrix,scmatrix,sparse_cdot,complex>(M1,M2.A);
01834 }
01835 
01836 inline scmatrix operator*(const srmatrix& M1, const scmatrix_slice& M2) {
01837   return spsp_mm_mult<srmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1,M2.A);
01838 }
01839 
01840 inline scmatrix operator*(const scmatrix& M1, const scmatrix_slice& M2) {
01841   return spsp_mm_mult<scmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1,M2.A);
01842 }
01843 
01844 inline cmatrix operator*(const scmatrix_slice& M1, const rmatrix& M2) {
01845   return spf_mm_mult<scmatrix,rmatrix,cmatrix,sparse_cdot>(M1.A,M2);
01846 }
01847 
01848 inline cmatrix operator*(const srmatrix_slice& M1, const cmatrix& M2) {
01849   return spf_mm_mult<srmatrix,cmatrix,cmatrix,sparse_cdot>(M1.A,M2);
01850 }
01851 
01852 inline cmatrix operator*(const scmatrix_slice& M1, const cmatrix& M2) {
01853   return spf_mm_mult<scmatrix,cmatrix,cmatrix,sparse_cdot>(M1.A,M2);
01854 }
01855 
01856 inline cmatrix operator*(const cmatrix& M1, const srmatrix_slice& M2) {
01857   return fsp_mm_mult<cmatrix,srmatrix,cmatrix,sparse_cdot>(M1,M2.A);
01858 }
01859 
01860 inline cmatrix operator*(const rmatrix& M1, const scmatrix_slice& M2) {
01861   return fsp_mm_mult<rmatrix,scmatrix,cmatrix,sparse_cdot>(M1,M2.A);
01862 }
01863 
01864 inline cmatrix operator*(const cmatrix& M1, const scmatrix_slice& M2) {
01865   return fsp_mm_mult<cmatrix,scmatrix,cmatrix,sparse_cdot>(M1,M2.A);
01866 }
01867 
01868 inline cmatrix operator*(const scmatrix_slice& M1, const rmatrix_slice& M2) {
01869   return spf_mm_mult<scmatrix,rmatrix_slice,cmatrix,sparse_cdot>(M1.A,M2);
01870 }
01871 
01872 inline cmatrix operator*(const srmatrix_slice& M1, const cmatrix_slice& M2) {
01873   return spf_mm_mult<srmatrix,cmatrix_slice,cmatrix,sparse_cdot>(M1.A,M2);
01874 }
01875 
01876 inline cmatrix operator*(const scmatrix_slice& M1, const cmatrix_slice& M2) {
01877   return spf_mm_mult<scmatrix,cmatrix_slice,cmatrix,sparse_cdot>(M1.A,M2);
01878 }
01879 
01880 inline cmatrix operator*(const cmatrix_slice& M1, const srmatrix_slice& M2) {
01881   return fsp_mm_mult<cmatrix,srmatrix,cmatrix,sparse_cdot>(M1,M2.A);
01882 }
01883 
01884 inline cmatrix operator*(const rmatrix_slice& M1, const scmatrix_slice& M2) {
01885   return fsp_mm_mult<rmatrix,scmatrix,cmatrix,sparse_cdot>(M1,M2.A);
01886 }
01887 
01888 inline cmatrix operator*(const cmatrix_slice& M1, const scmatrix_slice& M2) {
01889   return fsp_mm_mult<cmatrix,scmatrix,cmatrix,sparse_cdot>(M1,M2.A);
01890 }
01891 
01892 inline scvector operator*(const scmatrix_slice& M, const srvector& v) {
01893   return spsp_mv_mult<scmatrix,srvector,scvector,sparse_cdot,complex>(M.A,v);
01894 }
01895 
01896 inline scvector operator*(const srmatrix_slice& M, const scvector& v) {
01897   return spsp_mv_mult<srmatrix,scvector,scvector,sparse_cdot,complex>(M.A,v);
01898 }
01899 
01900 inline scvector operator*(const scmatrix_slice& M, const scvector& v) {
01901   return spsp_mv_mult<scmatrix,scvector,scvector,sparse_cdot,complex>(M.A,v);
01902 }
01903 
01904 inline scvector operator*(const scmatrix_slice& M, const srvector_slice& v) {
01905   return spsl_mv_mult<scmatrix,srvector_slice,scvector,sparse_cdot,complex>(M.A,v);
01906 }
01907 
01908 inline scvector operator*(const srmatrix_slice& M, const scvector_slice& v) {
01909   return spsl_mv_mult<srmatrix,scvector_slice,scvector,sparse_cdot,complex>(M.A,v);
01910 }
01911 
01912 inline scvector operator*(const scmatrix_slice& M, const scvector_slice& v) {
01913   return spsl_mv_mult<scmatrix,scvector_slice,scvector,sparse_cdot,complex>(M.A,v);
01914 }
01915 
01916 inline cvector operator*(const scmatrix_slice& M, const rvector& v) {
01917   return spf_mv_mult<scmatrix,rvector,cvector,sparse_cdot>(M.A,v);
01918 }
01919 
01920 inline cvector operator*(const srmatrix_slice& M, const cvector& v) {
01921   return spf_mv_mult<srmatrix,cvector,cvector,sparse_cdot>(M.A,v);
01922 }
01923 
01924 inline cvector operator*(const scmatrix_slice& M, const cvector& v) {
01925   return spf_mv_mult<scmatrix,cvector,cvector,sparse_cdot>(M.A,v);
01926 }
01927 
01928 inline cvector operator*(const scmatrix_slice& M, const rvector_slice& v) {
01929   return spf_mv_mult<scmatrix,rvector_slice,cvector,sparse_cdot>(M.A,v);
01930 }
01931 
01932 inline cvector operator*(const srmatrix_slice& M, const cvector_slice& v) {
01933   return spf_mv_mult<srmatrix,cvector_slice,cvector,sparse_cdot>(M.A,v);
01934 }
01935 
01936 inline cvector operator*(const scmatrix_slice& M, const cvector_slice& v) {
01937   return spf_mv_mult<scmatrix,cvector_slice,cvector,sparse_cdot>(M.A,v);
01938 }
01939 
01940 inline scmatrix operator*(const scmatrix_slice& M, const real& r) {
01941   return sp_ms_mult<scmatrix,real,scmatrix>(M.A,r);
01942 }
01943 
01944 inline scmatrix operator*(const scmatrix_slice& M, const complex& r) {
01945   return sp_ms_mult<scmatrix,complex,scmatrix>(M.A,r);
01946 }
01947 
01948 inline scmatrix operator*(const srmatrix_slice& M, const complex& r) {
01949   return sp_ms_mult<srmatrix,complex,scmatrix>(M.A,r);
01950 }
01951 
01952 inline scmatrix operator/(const scmatrix_slice& M, const real& r) {
01953   return sp_ms_div<scmatrix,real,scmatrix>(M.A,r);
01954 }
01955 
01956 inline scmatrix operator/(const scmatrix_slice& M, const complex& r) {
01957   return sp_ms_div<scmatrix,complex,scmatrix>(M.A,r);
01958 }
01959 
01960 inline scmatrix operator/(const srmatrix_slice& M, const complex& r) {
01961   return sp_ms_div<srmatrix,complex,scmatrix>(M.A,r);
01962 }
01963 
01964 inline scmatrix operator*(const real& r, const scmatrix_slice& M) {
01965   return sp_sm_mult<real,scmatrix,scmatrix>(r,M.A);
01966 }
01967 
01968 inline scmatrix operator*(const complex& r, const srmatrix_slice& M) {
01969   return sp_sm_mult<complex,srmatrix,scmatrix>(r,M.A);
01970 }
01971 
01972 inline scmatrix operator*(const complex& r, const scmatrix_slice& M) {
01973   return sp_sm_mult<complex,scmatrix,scmatrix>(r,M.A);
01974 }
01975 
01976 inline scmatrix operator+(const scmatrix_slice& M1, const srmatrix_slice& M2) {
01977   return spsp_mm_add<scmatrix,srmatrix,scmatrix,complex>(M1.A,M2.A);
01978 }
01979 
01980 inline scmatrix operator+(const srmatrix_slice& M1, const scmatrix_slice& M2) {
01981   return spsp_mm_add<srmatrix,scmatrix,scmatrix,complex>(M1.A,M2.A);
01982 }
01983 
01984 inline scmatrix operator+(const scmatrix_slice& M1, const scmatrix_slice& M2) {
01985   return spsp_mm_add<scmatrix,scmatrix,scmatrix,complex>(M1.A,M2.A);
01986 }
01987 
01988 inline scmatrix operator+(const scmatrix_slice& M1, const srmatrix& M2) {
01989   return spsp_mm_add<scmatrix,srmatrix,scmatrix,complex>(M1.A,M2);
01990 }
01991 
01992 inline scmatrix operator+(const srmatrix_slice& M1, const scmatrix& M2) {
01993   return spsp_mm_add<srmatrix,scmatrix,scmatrix,complex>(M1.A,M2);
01994 }
01995 
01996 inline scmatrix operator+(const scmatrix_slice& M1, const scmatrix& M2) {
01997   return spsp_mm_add<scmatrix,scmatrix,scmatrix,complex>(M1.A,M2);
01998 }
01999 
02000 inline scmatrix operator+(const scmatrix& M1, const srmatrix_slice& M2) {
02001   return spsp_mm_add<scmatrix,srmatrix,scmatrix,complex>(M1,M2.A);
02002 }
02003 
02004 inline scmatrix operator+(const srmatrix& M1, const scmatrix_slice& M2) {
02005   return spsp_mm_add<srmatrix,scmatrix,scmatrix,complex>(M1,M2.A);
02006 }
02007 
02008 inline scmatrix operator+(const scmatrix& M1, const scmatrix_slice& M2) {
02009   return spsp_mm_add<scmatrix,scmatrix,scmatrix,complex>(M1,M2.A);
02010 }
02011 
02012 inline cmatrix operator+(const scmatrix_slice& M1, const rmatrix& M2) {
02013   return spf_mm_add<scmatrix,rmatrix,cmatrix>(M1.A,M2);
02014 }
02015 
02016 inline cmatrix operator+(const srmatrix_slice& M1, const cmatrix& M2) {
02017   return spf_mm_add<srmatrix,cmatrix,cmatrix>(M1.A,M2);
02018 }
02019 
02020 inline cmatrix operator+(const scmatrix_slice& M1, const cmatrix& M2) {
02021   return spf_mm_add<scmatrix,cmatrix,cmatrix>(M1.A,M2);
02022 }
02023 
02024 inline cmatrix operator+(const cmatrix& M1, const srmatrix_slice& M2) {
02025   return fsp_mm_add<cmatrix,srmatrix,cmatrix>(M1,M2.A);
02026 }
02027 
02028 inline cmatrix operator+(const rmatrix& M1, const scmatrix_slice& M2) {
02029   return fsp_mm_add<rmatrix,scmatrix,cmatrix>(M1,M2.A);
02030 }
02031 
02032 inline cmatrix operator+(const cmatrix& M1, const scmatrix_slice& M2) {
02033   return fsp_mm_add<cmatrix,scmatrix,cmatrix>(M1,M2.A);
02034 }
02035 
02036 inline cmatrix operator+(const scmatrix_slice& M1, const rmatrix_slice& M2) {
02037   return spf_mm_add<scmatrix,rmatrix_slice,cmatrix>(M1.A,M2);
02038 }
02039 
02040 inline cmatrix operator+(const srmatrix_slice& M1, const cmatrix_slice& M2) {
02041   return spf_mm_add<srmatrix,cmatrix_slice,cmatrix>(M1.A,M2);
02042 }
02043 
02044 inline cmatrix operator+(const scmatrix_slice& M1, const cmatrix_slice& M2) {
02045   return spf_mm_add<scmatrix,cmatrix_slice,cmatrix>(M1.A,M2);
02046 }
02047 
02048 inline cmatrix operator+(const cmatrix_slice& M1, const srmatrix_slice& M2) {
02049   return fsp_mm_add<cmatrix_slice,srmatrix,cmatrix>(M1,M2.A);
02050 }
02051 
02052 inline cmatrix operator+(const rmatrix_slice& M1, const scmatrix_slice& M2) {
02053   return fsp_mm_add<rmatrix_slice,scmatrix,cmatrix>(M1,M2.A);
02054 }
02055 
02056 inline cmatrix operator+(const cmatrix_slice& M1, const scmatrix_slice& M2) {
02057   return fsp_mm_add<cmatrix_slice,scmatrix,cmatrix>(M1,M2.A);
02058 }
02059 
02060 inline scmatrix operator-(const scmatrix_slice& M1, const srmatrix_slice& M2) {
02061   return spsp_mm_sub<scmatrix,srmatrix,scmatrix,complex>(M1.A,M2.A);
02062 }
02063 
02064 inline scmatrix operator-(const srmatrix_slice& M1, const scmatrix_slice& M2) {
02065   return spsp_mm_sub<srmatrix,scmatrix,scmatrix,complex>(M1.A,M2.A);
02066 }
02067 
02068 inline scmatrix operator-(const scmatrix_slice& M1, const scmatrix_slice& M2) {
02069   return spsp_mm_sub<scmatrix,scmatrix,scmatrix,complex>(M1.A,M2.A);
02070 }
02071 
02072 inline scmatrix operator-(const scmatrix_slice& M1, const srmatrix& M2) {
02073   return spsp_mm_sub<scmatrix,srmatrix,scmatrix,complex>(M1.A,M2);
02074 }
02075 
02076 inline scmatrix operator-(const srmatrix_slice& M1, const scmatrix& M2) {
02077   return spsp_mm_sub<srmatrix,scmatrix,scmatrix,complex>(M1.A,M2);
02078 }
02079 
02080 inline scmatrix operator-(const scmatrix_slice& M1, const scmatrix& M2) {
02081   return spsp_mm_sub<scmatrix,scmatrix,scmatrix,complex>(M1.A,M2);
02082 }
02083 
02084 inline scmatrix operator-(const scmatrix& M1, const srmatrix_slice& M2) {
02085   return spsp_mm_sub<scmatrix,srmatrix,scmatrix,complex>(M1,M2.A);
02086 }
02087 
02088 inline scmatrix operator-(const srmatrix& M1, const scmatrix_slice& M2) {
02089   return spsp_mm_sub<srmatrix,scmatrix,scmatrix,complex>(M1,M2.A);
02090 }
02091 
02092 inline scmatrix operator-(const scmatrix& M1, const scmatrix_slice& M2) {
02093   return spsp_mm_sub<scmatrix,scmatrix,scmatrix,complex>(M1,M2.A);
02094 }
02095 
02096 inline cmatrix operator-(const scmatrix_slice& M1, const rmatrix& M2) {
02097   return spf_mm_sub<scmatrix,rmatrix,cmatrix>(M1.A,M2);
02098 }
02099 
02100 inline cmatrix operator-(const srmatrix_slice& M1, const cmatrix& M2) {
02101   return spf_mm_sub<srmatrix,cmatrix,cmatrix>(M1.A,M2);
02102 }
02103 
02104 inline cmatrix operator-(const scmatrix_slice& M1, const cmatrix& M2) {
02105   return spf_mm_sub<scmatrix,cmatrix,cmatrix>(M1.A,M2);
02106 }
02107 
02108 inline cmatrix operator-(const cmatrix& M1, const srmatrix_slice& M2) {
02109   return fsp_mm_sub<cmatrix,srmatrix,cmatrix>(M1,M2.A);
02110 }
02111 
02112 inline cmatrix operator-(const rmatrix& M1, const scmatrix_slice& M2) {
02113   return fsp_mm_sub<rmatrix,scmatrix,cmatrix>(M1,M2.A);
02114 }
02115 
02116 inline cmatrix operator-(const cmatrix& M1, const scmatrix_slice& M2) {
02117   return fsp_mm_sub<cmatrix,scmatrix,cmatrix>(M1,M2.A);
02118 }
02119 
02120 inline cmatrix operator-(const scmatrix_slice& M1, const rmatrix_slice& M2) {
02121   return spf_mm_sub<scmatrix,rmatrix_slice,cmatrix>(M1.A,M2);
02122 }
02123 
02124 inline cmatrix operator-(const srmatrix_slice& M1, const cmatrix_slice& M2) {
02125   return spf_mm_sub<srmatrix,cmatrix_slice,cmatrix>(M1.A,M2);
02126 }
02127 
02128 inline cmatrix operator-(const scmatrix_slice& M1, const cmatrix_slice& M2) {
02129   return spf_mm_sub<scmatrix,cmatrix_slice,cmatrix>(M1.A,M2);
02130 }
02131 
02132 inline cmatrix operator-(const cmatrix_slice& M1, const srmatrix_slice& M2) {
02133   return fsp_mm_sub<cmatrix_slice,srmatrix,cmatrix>(M1,M2.A);
02134 }
02135 
02136 inline cmatrix operator-(const rmatrix_slice& M1, const scmatrix_slice& M2) {
02137   return fsp_mm_sub<rmatrix_slice,scmatrix,cmatrix>(M1,M2.A);
02138 }
02139 
02140 inline cmatrix operator-(const cmatrix_slice& M1, const scmatrix_slice& M2) {
02141   return fsp_mm_sub<cmatrix_slice,scmatrix,cmatrix>(M1,M2.A);
02142 }
02143 
02144 inline cmatrix& cmatrix::operator=(const srmatrix_slice& M) {
02145   *this = rmatrix(M);
02146   return *this;
02147 }
02148 
02149 inline cmatrix& cmatrix::operator=(const scmatrix_slice& M) {
02150   *this = cmatrix(M);
02151   return *this;
02152 }
02153 
02154 inline cmatrix& cmatrix::operator+=(const srmatrix_slice& M) {
02155   *this += M.A;
02156   return *this;
02157 }
02158 
02159 inline cmatrix& cmatrix::operator+=(const scmatrix_slice& M) {
02160   *this += M.A;
02161   return *this;
02162 }
02163 
02164 inline cmatrix_slice& cmatrix_slice::operator+=(const srmatrix_slice& M) {
02165   *this += M.A;
02166   return *this;
02167 }
02168 
02169 inline cmatrix_slice& cmatrix_slice::operator+=(const scmatrix_slice& M) {
02170   *this += M.A;
02171   return *this;
02172 }
02173 
02174 inline cmatrix& cmatrix::operator-=(const srmatrix_slice& M) {
02175   *this -= M.A;
02176   return *this;
02177 }
02178 
02179 inline cmatrix& cmatrix::operator-=(const scmatrix_slice& M) {
02180   *this -= M.A;
02181   return *this;
02182 }
02183 
02184 inline cmatrix_slice& cmatrix_slice::operator-=(const srmatrix_slice& M) {
02185   *this -= M.A;
02186   return *this;
02187 }
02188 
02189 inline cmatrix_slice& cmatrix_slice::operator-=(const scmatrix_slice& M) {
02190   *this -= M.A;
02191   return *this;
02192 }
02193 
02194 inline cmatrix& cmatrix::operator*=(const srmatrix_slice& M) {
02195   *this *= M.A;
02196   return *this;
02197 }
02198 
02199 inline cmatrix& cmatrix::operator*=(const scmatrix_slice& M) {
02200   *this *= M.A;
02201   return *this;
02202 }
02203 
02204 inline cmatrix_slice& cmatrix_slice::operator*=(const srmatrix_slice& M) {
02205   *this *= M.A;
02206   return *this;
02207 }
02208 
02209 inline cmatrix_slice& cmatrix_slice::operator*=(const scmatrix_slice& M) {
02210   *this *= M.A;
02211   return *this;
02212 }
02213 
02214 inline bool operator==(const scmatrix_slice& M1, const srmatrix_slice& M2) {
02215   return spsp_mm_comp(M1.A,M2.A);
02216 }
02217 
02218 inline bool operator==(const srmatrix_slice& M1, const scmatrix_slice& M2) {
02219   return spsp_mm_comp(M1.A,M2.A);
02220 }
02221 
02222 inline bool operator==(const scmatrix_slice& M1, const scmatrix_slice& M2) {
02223   return spsp_mm_comp(M1.A,M2.A);
02224 }
02225 
02226 inline bool operator==(const scmatrix_slice& M1, const srmatrix& M2) {
02227   return spsp_mm_comp(M1.A,M2);
02228 }
02229 
02230 inline bool operator==(const srmatrix_slice& M1, const scmatrix& M2) {
02231   return spsp_mm_comp(M1.A,M2);
02232 }
02233 
02234 inline bool operator==(const scmatrix_slice& M1, const scmatrix& M2) {
02235   return spsp_mm_comp(M1.A,M2);
02236 }
02237 
02238 inline bool operator==(const scmatrix& M1, const srmatrix_slice& M2) {
02239   return spsp_mm_comp(M1,M2.A);
02240 }
02241 
02242 inline bool operator==(const srmatrix& M1, const scmatrix_slice& M2) {
02243   return spsp_mm_comp(M1,M2.A);
02244 }
02245 
02246 inline bool operator==(const scmatrix& M1, const scmatrix_slice& M2) {
02247   return spsp_mm_comp(M1,M2.A);
02248 }
02249 
02250 inline bool operator==(const scmatrix_slice& M1, const rmatrix& M2) {
02251   return spf_mm_comp(M1.A,M2);
02252 }
02253 
02254 inline bool operator==(const srmatrix_slice& M1, const cmatrix& M2) {
02255   return spf_mm_comp(M1.A,M2);
02256 }
02257 
02258 inline bool operator==(const scmatrix_slice& M1, const cmatrix& M2) {
02259   return spf_mm_comp(M1.A,M2);
02260 }
02261 
02262 inline bool operator==(const cmatrix& M1, const srmatrix_slice& M2) {
02263   return fsp_mm_comp(M1,M2.A);
02264 }
02265 
02266 inline bool operator==(const rmatrix& M1, const scmatrix_slice& M2) {
02267   return fsp_mm_comp(M1,M2.A);
02268 }
02269 
02270 inline bool operator==(const cmatrix& M1, const scmatrix_slice& M2) {
02271   return fsp_mm_comp(M1,M2.A);
02272 }
02273 
02274 inline bool operator==(const cmatrix_slice& M1, const srmatrix_slice& M2) {
02275   return fsp_mm_comp(M1,M2.A);
02276 }
02277 
02278 inline bool operator==(const rmatrix_slice& M1, const scmatrix_slice& M2) {
02279   return fsp_mm_comp(M1,M2.A);
02280 }
02281 
02282 inline bool operator==(const cmatrix_slice& M1, const scmatrix_slice& M2) {
02283   return fsp_mm_comp(M1,M2.A);
02284 }
02285 
02286 inline bool operator==(const scmatrix_slice& M1, const rmatrix_slice& M2) {
02287   return spf_mm_comp(M1.A,M2);
02288 }
02289 
02290 inline bool operator==(const srmatrix_slice& M1, const cmatrix_slice& M2) {
02291   return spf_mm_comp(M1.A,M2);
02292 }
02293 
02294 inline bool operator==(const scmatrix_slice& M1, const cmatrix_slice& M2) {
02295   return spf_mm_comp(M1.A,M2);
02296 }
02297 
02298 inline bool operator!=(const scmatrix_slice& M1, const srmatrix_slice& M2) {
02299   return !spsp_mm_comp(M1.A,M2.A);
02300 }
02301 
02302 inline bool operator!=(const srmatrix_slice& M1, const scmatrix_slice& M2) {
02303   return !spsp_mm_comp(M1.A,M2.A);
02304 }
02305 
02306 inline bool operator!=(const scmatrix_slice& M1, const scmatrix_slice& M2) {
02307   return !spsp_mm_comp(M1.A,M2.A);
02308 }
02309 
02310 inline bool operator!=(const scmatrix_slice& M1, const srmatrix& M2) {
02311   return !spsp_mm_comp(M1.A,M2);
02312 }
02313 
02314 inline bool operator!=(const srmatrix_slice& M1, const scmatrix& M2) {
02315   return !spsp_mm_comp(M1.A,M2);
02316 }
02317 
02318 inline bool operator!=(const scmatrix_slice& M1, const scmatrix& M2) {
02319   return !spsp_mm_comp(M1.A,M2);
02320 }
02321 
02322 inline bool operator!=(const scmatrix& M1, const srmatrix_slice& M2) {
02323   return !spsp_mm_comp(M1,M2.A);
02324 }
02325 
02326 inline bool operator!=(const srmatrix& M1, const scmatrix_slice& M2) {
02327   return !spsp_mm_comp(M1,M2.A);
02328 }
02329 
02330 inline bool operator!=(const scmatrix& M1, const scmatrix_slice& M2) {
02331   return !spsp_mm_comp(M1,M2.A);
02332 }
02333 
02334 inline bool operator!=(const scmatrix_slice& M1, const rmatrix& M2) {
02335   return !spf_mm_comp(M1.A,M2);
02336 }
02337 
02338 inline bool operator!=(const srmatrix_slice& M1, const cmatrix& M2) {
02339   return !spf_mm_comp(M1.A,M2);
02340 }
02341 
02342 inline bool operator!=(const scmatrix_slice& M1, const cmatrix& M2) {
02343   return !spf_mm_comp(M1.A,M2);
02344 }
02345 
02346 inline bool operator!=(const cmatrix& M1, const srmatrix_slice& M2) {
02347   return !fsp_mm_comp(M1,M2.A);
02348 }
02349 
02350 inline bool operator!=(const rmatrix& M1, const scmatrix_slice& M2) {
02351   return !fsp_mm_comp(M1,M2.A);
02352 }
02353 
02354 inline bool operator!=(const cmatrix& M1, const scmatrix_slice& M2) {
02355   return !fsp_mm_comp(M1,M2.A);
02356 }
02357 
02358 inline bool operator!=(const cmatrix_slice& M1, const srmatrix_slice& M2) {
02359   return !fsp_mm_comp(M1,M2.A);
02360 }
02361 
02362 inline bool operator!=(const rmatrix_slice& M1, const scmatrix_slice& M2) {
02363   return !fsp_mm_comp(M1,M2.A);
02364 }
02365 
02366 inline bool operator!=(const cmatrix_slice& M1, const scmatrix_slice& M2) {
02367   return !fsp_mm_comp(M1,M2.A);
02368 }
02369 
02370 inline bool operator!=(const scmatrix_slice& M1, const rmatrix_slice& M2) {
02371   return !spf_mm_comp(M1.A,M2);
02372 }
02373 
02374 inline bool operator!=(const srmatrix_slice& M1, const cmatrix_slice& M2) {
02375   return !spf_mm_comp(M1.A,M2);
02376 }
02377 
02378 inline bool operator!=(const scmatrix_slice& M1, const cmatrix_slice& M2) {
02379   return !spf_mm_comp(M1.A,M2);
02380 }
02381 
02382 inline bool operator!(const scmatrix_slice& M) {
02383   return sp_m_not(M.A);
02384 }
02385 
02386 inline std::ostream& operator<<(std::ostream& os, const scmatrix_slice& M) {
02387   return sp_m_output<scmatrix,complex>(os, M.A);
02388 }
02389 
02390 inline std::istream& operator>>(std::istream& is, scmatrix_slice& M) {
02391   scmatrix tmp(M.A.m, M.A.n);
02392   is >> tmp;
02393   M = tmp;
02394   return is;
02395 }
02396 
02397 
02398 class scmatrix_subv {
02399   private:
02400     scmatrix_slice dat;
02401     bool row;
02402     int index;
02403 
02404     scmatrix_subv(scmatrix& A, bool r, int i, int j, int k, int l) : dat(A,i,j,k,l), row(r) {
02405        if(row) index=i; else index=k;
02406     }
02407 
02408     scmatrix_subv(const scmatrix& A, bool r, int i, int j, int k, int l) : dat(A,i,j,k,l), row(r) {
02409        if(row) index=i; else index=k;
02410     }
02411 
02412   
02413   public:
02414     complex& operator[](const int i) {
02415       if(row) {
02416 #if(CXSC_INDEX_CHECK)
02417         if(i<dat.A.lb2 || i>dat.A.ub2)
02418           cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_subv::operator[](int)"));
02419 #endif
02420         return dat.element(index,i);
02421       } else {
02422 #if(CXSC_INDEX_CHECK)
02423         if(i<dat.A.lb1 || i>dat.A.ub1)
02424           cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_subv::operator[](int)"));
02425 #endif
02426         return dat.element(i,index);
02427       }
02428     }
02429 
02430     const complex operator[](const int i) const {
02431       if(row) {
02432 #if(CXSC_INDEX_CHECK)
02433         if(i<dat.A.lb2 || i>dat.A.ub2)
02434           cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_subv::operator[](int)"));
02435 #endif
02436         return dat(index,i);
02437       } else {
02438 #if(CXSC_INDEX_CHECK)
02439         if(i<dat.A.lb1 || i>dat.A.ub1)
02440           cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_subv::operator[](int)"));
02441 #endif
02442         return dat(i,index);
02443       }
02444     }
02445 
02446     scmatrix_subv& operator=(const real& v) {
02447       return sv_vs_assign(*this,v);
02448     }
02449 
02450     scmatrix_subv& operator=(const complex& v) {
02451       return sv_vs_assign(*this,v);
02452     }
02453 
02454     scmatrix_subv& operator=(const srvector& v) {
02455       return svsp_vv_assign(*this,v);
02456     }
02457 
02458     scmatrix_subv& operator=(const scvector& v) {
02459       return svsp_vv_assign(*this,v);
02460     }
02461 
02462     scmatrix_subv& operator=(const srvector_slice& v) {
02463       return svsl_vv_assign(*this,v);
02464     }
02465 
02466     scmatrix_subv& operator=(const scvector_slice& v) {
02467       return svsl_vv_assign(*this,v);
02468     }
02469 
02470     scmatrix_subv& operator=(const rvector& v) {
02471       return svf_vv_assign(*this,v);
02472     }
02473 
02474     scmatrix_subv& operator=(const cvector& v) {
02475       return svf_vv_assign(*this,v);
02476     }
02477 
02478     scmatrix_subv& operator=(const rvector_slice& v) {
02479       return svf_vv_assign(*this,v);
02480     }
02481 
02482     scmatrix_subv& operator=(const cvector_slice& v) {
02483       return svf_vv_assign(*this,v);
02484     }
02485 
02486     scmatrix_subv& operator=(const srmatrix_subv& v) {
02487       return svsp_vv_assign(*this,srvector(v));
02488     }
02489 
02490     scmatrix_subv& operator=(const scmatrix_subv& v) {
02491       return svsp_vv_assign(*this,scvector(v));
02492     }
02493 
02494 
02495     scmatrix_subv& operator*=(const real&);
02496     scmatrix_subv& operator*=(const complex&);
02497     scmatrix_subv& operator/=(const real&);
02498     scmatrix_subv& operator/=(const complex&);
02499     scmatrix_subv& operator+=(const srvector&);
02500     scmatrix_subv& operator+=(const srvector_slice&);
02501     scmatrix_subv& operator+=(const rvector&);
02502     scmatrix_subv& operator+=(const rvector_slice&);
02503     scmatrix_subv& operator-=(const srvector&);
02504     scmatrix_subv& operator-=(const srvector_slice&);
02505     scmatrix_subv& operator-=(const rvector&);
02506     scmatrix_subv& operator-=(const rvector_slice&);
02507     scmatrix_subv& operator+=(const scvector&);
02508     scmatrix_subv& operator+=(const scvector_slice&);
02509     scmatrix_subv& operator+=(const cvector&);
02510     scmatrix_subv& operator+=(const cvector_slice&);
02511     scmatrix_subv& operator-=(const scvector&);
02512     scmatrix_subv& operator-=(const scvector_slice&);
02513     scmatrix_subv& operator-=(const cvector&);
02514     scmatrix_subv& operator-=(const cvector_slice&);
02515 
02516     friend scvector operator-(const scmatrix_subv&);
02517     friend std::istream& operator>>(std::istream&, scmatrix_subv&);
02518 
02519     friend int Lb(const scmatrix_subv&);
02520     friend int Ub(const scmatrix_subv&);
02521     friend int VecLen(const scmatrix_subv&);
02522     friend srvector Re(const scmatrix_subv&);
02523     friend srvector Im(const scmatrix_subv&);
02524 
02525     friend class srvector;
02526     friend class srmatrix;
02527     friend class srmatrix_slice;
02528     friend class scvector;
02529     friend class scmatrix;
02530     friend class scmatrix_slice;
02531     friend class scivector;
02532     friend class scimatrix;
02533     friend class scimatrix_slice;
02534 
02535 #include "vector_friend_declarations.inl"
02536 };
02537 
02538 inline int Lb(const scmatrix_subv& S) {
02539   if(S.row)
02540     return Lb(S.dat, 2);
02541   else
02542     return Lb(S.dat, 1);
02543 }
02544 
02545 inline int Ub(const scmatrix_subv& S) {
02546   if(S.row)
02547     return Ub(S.dat, 2);
02548   else
02549     return Ub(S.dat, 1);
02550 }
02551 
02552 inline int VecLen(const scmatrix_subv& S) {
02553   return Ub(S)-Lb(S)+1;
02554 }
02555 
02556 inline srvector Re(const scmatrix_subv& S) {
02557   return Re(scvector(S));
02558 }
02559 
02560 inline srvector Im(const scmatrix_subv& S) {
02561   return Im(scvector(S));
02562 }
02563 
02564 inline std::ostream& operator<<(std::ostream& os, const scmatrix_subv& v) {
02565   os << scvector(v);
02566   return os;
02567 }
02568 
02569 inline std::istream& operator>>(std::istream& is, scmatrix_subv& v) {
02570   int n=0;
02571   if(v.row) n=v.dat.A.n; else n=v.dat.A.m;
02572   scvector tmp(n);
02573   is >> tmp;
02574   v = tmp;
02575   return is;
02576 }
02577 
02578 inline scmatrix_subv scmatrix::operator[](const cxscmatrix_column& c) {
02579 #if(CXSC_INDEX_CHECK)
02580   if(c.col()<lb2 || c.col()>ub2)
02581     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator[](const cxscmatrix_column&)"));
02582 #endif
02583   return scmatrix_subv(*this, false, lb1, ub1, c.col(), c.col());
02584 }
02585 
02586 inline scmatrix_subv scmatrix::operator[](const int i) {
02587 #if(CXSC_INDEX_CHECK)
02588   if(i<lb1 || i>ub1)
02589     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator[](const int)"));
02590 #endif
02591   return scmatrix_subv(*this, true, i, i, lb2, ub2);
02592 }
02593 
02594 inline const scmatrix_subv scmatrix::operator[](const cxscmatrix_column& c) const {
02595 #if(CXSC_INDEX_CHECK)
02596   if(c.col()<lb2 || c.col()>ub2)
02597     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator[](const cxscmatrix_column&)"));
02598 #endif
02599   return scmatrix_subv(*this, false, lb1, ub1, c.col(), c.col());
02600 }
02601 
02602 inline const scmatrix_subv scmatrix::operator[](const int i) const {
02603 #if(CXSC_INDEX_CHECK)
02604   if(i<lb1 || i>ub1)
02605     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator[](const int)"));
02606 #endif
02607   return scmatrix_subv(*this, true, i, i, lb2, ub2);
02608 }
02609 
02610 inline scmatrix_subv scmatrix_slice::operator[](const int i) {
02611 #if(CXSC_INDEX_CHECK)
02612   if(i<A.lb1 || i>A.ub1)
02613     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix_slice::operator[](const int)"));
02614 #endif
02615   return scmatrix_subv(*M, true, i, i, A.lb2, A.ub2);
02616 }
02617 
02618 inline scmatrix_subv scmatrix_slice::operator[](const cxscmatrix_column& c) {
02619 #if(CXSC_INDEX_CHECK)
02620   if(c.col()<A.lb2 || c.col()>A.ub2)
02621     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix_slice::operator[](const cxscmatrix_column&)"));
02622 #endif
02623   return scmatrix_subv(*M, false, A.lb1, A.ub1, c.col(), c.col());
02624 }
02625 
02626 inline const scmatrix_subv scmatrix_slice::operator[](const int i) const {
02627 #if(CXSC_INDEX_CHECK)
02628   if(i<A.lb1 || i>A.ub1)
02629     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix_slice::operator[](const int)"));
02630 #endif
02631   return scmatrix_subv(*M, true, i, i, A.lb2, A.ub2);
02632 }
02633 
02634 inline const scmatrix_subv scmatrix_slice::operator[](const cxscmatrix_column& c) const {
02635 #if(CXSC_INDEX_CHECK)
02636   if(c.col()<A.lb2 || c.col()>A.ub2)
02637     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix_slice::operator[](const cxscmatrix_column&)"));
02638 #endif
02639   return scmatrix_subv(*M, false, A.lb1, A.ub1, c.col(), c.col());
02640 }
02641 
02642 inline scvector::scvector(const scmatrix_subv& A) {
02643   int nnz = A.dat.A.get_nnz();
02644   p.reserve(nnz);
02645   x.reserve(nnz);
02646 
02647   if(A.row) {
02648     lb = A.dat.A.lb2;
02649     ub = A.dat.A.ub2;
02650     n = ub-lb+1; 
02651 
02652     for(int j=0 ; j<n ; j++) {
02653       for(int k=A.dat.A.p[j] ; k<A.dat.A.p[j+1] ; k++) {
02654         p.push_back(j);
02655         x.push_back(A.dat.A.x[k]);
02656       }
02657     }
02658 
02659   } else {
02660     lb = A.dat.A.lb1;
02661     ub = A.dat.A.ub1;
02662     n = ub-lb+1; 
02663 
02664     for(unsigned int k=0 ; k<A.dat.A.ind.size() ; k++) {
02665         p.push_back(A.dat.A.ind[k]);
02666         x.push_back(A.dat.A.x[k]);
02667     }
02668   }
02669 }
02670 
02671 inline scvector operator-(const scmatrix_subv& v) {
02672  scvector s(v);
02673  return -s;
02674 }
02675 
02676 inline scvector operator/(const scmatrix_subv& v1, const real& v2) {
02677   return scvector(v1) / v2;
02678 }
02679 
02680 inline scvector operator/(const scmatrix_subv& v1, const complex& v2) {
02681   return scvector(v1) / v2;
02682 }
02683 
02684 inline scvector operator/(const srmatrix_subv& v1, const complex& v2) {
02685   return srvector(v1) / v2;
02686 }
02687 
02688 inline scvector operator*(const scmatrix_subv& v1, const real& v2) {
02689   return scvector(v1) * v2;
02690 }
02691 
02692 inline scvector operator*(const scmatrix_subv& v1, const complex& v2) {
02693   return scvector(v1) * v2;
02694 }
02695 
02696 inline scvector operator*(const srmatrix_subv& v1, const complex& v2) {
02697   return srvector(v1) * v2;
02698 }
02699 
02700 inline scvector operator*(const real& v1, const scmatrix_subv& v2) {
02701   return v1 * scvector(v2);
02702 }
02703 
02704 inline scvector operator*(const complex& v1, const scmatrix_subv& v2) {
02705   return v1 * scvector(v2);
02706 }
02707 
02708 inline scvector operator*(const complex& v1, const srmatrix_subv& v2) {
02709   return v1 * srvector(v2);
02710 }
02711 
02712 inline complex operator*(const scmatrix_subv& v1, const srvector& v2) {
02713   return scvector(v1) * v2;
02714 }
02715 
02716 inline complex operator*(const srmatrix_subv& v1, const scvector& v2) {
02717   return srvector(v1) * v2;
02718 }
02719 
02720 inline complex operator*(const scmatrix_subv& v1, const scvector& v2) {
02721   return scvector(v1) * v2;
02722 }
02723 
02724 inline complex operator*(const scmatrix_subv& v1, const srvector_slice& v2) {
02725   return scvector(v1) * v2;
02726 }
02727 
02728 inline complex operator*(const srmatrix_subv& v1, const scvector_slice& v2) {
02729   return srvector(v1) * v2;
02730 }
02731 
02732 inline complex operator*(const scmatrix_subv& v1, const scvector_slice& v2) {
02733   return scvector(v1) * v2;
02734 }
02735 
02736 inline complex operator*(const scmatrix_subv& v1, const rvector& v2) {
02737   return scvector(v1) * v2;
02738 }
02739 
02740 inline complex operator*(const srmatrix_subv& v1, const cvector& v2) {
02741   return srvector(v1) * v2;
02742 }
02743 
02744 inline complex operator*(const scmatrix_subv& v1, const cvector& v2) {
02745   return scvector(v1) * v2;
02746 }
02747 
02748 inline complex operator*(const scmatrix_subv& v1, const rvector_slice& v2) {
02749   return scvector(v1) * v2;
02750 }
02751 
02752 inline complex operator*(const srmatrix_subv& v1, const cvector_slice& v2) {
02753   return srvector(v1) * v2;
02754 }
02755 
02756 inline complex operator*(const scmatrix_subv& v1, const cvector_slice& v2) {
02757   return scvector(v1) * v2;
02758 }
02759 
02760 inline complex operator*(const scvector& v1, const srmatrix_subv& v2) {
02761   return v1 * srvector(v2);
02762 }
02763 
02764 inline complex operator*(const srvector& v1, const scmatrix_subv& v2) {
02765   return v1 * scvector(v2);
02766 }
02767 
02768 inline complex operator*(const scvector& v1, const scmatrix_subv& v2) {
02769   return v1 * scvector(v2);
02770 }
02771 
02772 inline complex operator*(const scvector_slice& v1, const srmatrix_subv& v2) {
02773   return v1 * srvector(v2);
02774 }
02775 
02776 inline complex operator*(const srvector_slice& v1, const scmatrix_subv& v2) {
02777   return v1 * scvector(v2);
02778 }
02779 
02780 inline complex operator*(const scvector_slice& v1, const scmatrix_subv& v2) {
02781   return v1 * scvector(v2);
02782 }
02783 
02784 inline complex operator*(const cvector& v1, const srmatrix_subv& v2) {
02785   return v1 * srvector(v2);
02786 }
02787 
02788 inline complex operator*(const rvector& v1, const scmatrix_subv& v2) {
02789   return v1 * scvector(v2);
02790 }
02791 
02792 inline complex operator*(const cvector& v1, const scmatrix_subv& v2) {
02793   return v1 * scvector(v2);
02794 }
02795 
02796 inline complex operator*(const cvector_slice& v1, const srmatrix_subv& v2) {
02797   return v1 * srvector(v2);
02798 }
02799 
02800 inline complex operator*(const rvector_slice& v1, const scmatrix_subv& v2) {
02801   return v1 * scvector(v2);
02802 }
02803 
02804 inline complex operator*(const cvector_slice& v1, const scmatrix_subv& v2) {
02805   return v1 * scvector(v2);
02806 }
02807 
02808 inline scvector operator+(const scmatrix_subv& v1, const srvector& v2) {
02809   return scvector(v1) + v2;
02810 }
02811 
02812 inline scvector operator+(const srmatrix_subv& v1, const scvector& v2) {
02813   return srvector(v1) + v2;
02814 }
02815 
02816 inline scvector operator+(const scmatrix_subv& v1, const scvector& v2) {
02817   return scvector(v1) + v2;
02818 }
02819 
02820 inline scvector operator+(const scmatrix_subv& v1, const srvector_slice& v2) {
02821   return scvector(v1) + v2;
02822 }
02823 
02824 inline scvector operator+(const srmatrix_subv& v1, const scvector_slice& v2) {
02825   return srvector(v1) + v2;
02826 }
02827 
02828 inline scvector operator+(const scmatrix_subv& v1, const scvector_slice& v2) {
02829   return scvector(v1) + v2;
02830 }
02831 
02832 inline cvector operator+(const scmatrix_subv& v1, const rvector& v2) {
02833   return scvector(v1) + v2;
02834 }
02835 
02836 inline cvector operator+(const srmatrix_subv& v1, const cvector& v2) {
02837   return srvector(v1) + v2;
02838 }
02839 
02840 inline cvector operator+(const scmatrix_subv& v1, const cvector& v2) {
02841   return scvector(v1) + v2;
02842 }
02843 
02844 inline cvector operator+(const scmatrix_subv& v1, const rvector_slice& v2) {
02845   return scvector(v1) + v2;
02846 }
02847 
02848 inline cvector operator+(const srmatrix_subv& v1, const cvector_slice& v2) {
02849   return srvector(v1) + v2;
02850 }
02851 
02852 inline cvector operator+(const scmatrix_subv& v1, const cvector_slice& v2) {
02853   return scvector(v1) + v2;
02854 }
02855 
02856 inline scvector operator+(const scvector& v1, const srmatrix_subv& v2) {
02857   return v1 + srvector(v2);
02858 }
02859 
02860 inline scvector operator+(const srvector& v1, const scmatrix_subv& v2) {
02861   return v1 + scvector(v2);
02862 }
02863 
02864 inline scvector operator+(const scvector& v1, const scmatrix_subv& v2) {
02865   return v1 + scvector(v2);
02866 }
02867 
02868 inline scvector operator+(const scvector_slice& v1, const srmatrix_subv& v2) {
02869   return v1 + srvector(v2);
02870 }
02871 
02872 inline scvector operator+(const srvector_slice& v1, const scmatrix_subv& v2) {
02873   return v1 + scvector(v2);
02874 }
02875 
02876 inline scvector operator+(const scvector_slice& v1, const scmatrix_subv& v2) {
02877   return v1 + scvector(v2);
02878 }
02879 
02880 inline cvector operator+(const cvector& v1, const srmatrix_subv& v2) {
02881   return v1 + srvector(v2);
02882 }
02883 
02884 inline cvector operator+(const rvector& v1, const scmatrix_subv& v2) {
02885   return v1 + scvector(v2);
02886 }
02887 
02888 inline cvector operator+(const cvector& v1, const scmatrix_subv& v2) {
02889   return v1 + scvector(v2);
02890 }
02891 
02892 inline cvector operator+(const cvector_slice& v1, const srmatrix_subv& v2) {
02893   return v1 + srvector(v2);
02894 }
02895 
02896 inline cvector operator+(const rvector_slice& v1, const scmatrix_subv& v2) {
02897   return v1 + scvector(v2);
02898 }
02899 
02900 inline cvector operator+(const cvector_slice& v1, const scmatrix_subv& v2) {
02901   return v1 + scvector(v2);
02902 }
02903 
02904 inline scvector operator-(const scmatrix_subv& v1, const srvector& v2) {
02905   return scvector(v1) - v2;
02906 }
02907 
02908 inline scvector operator-(const srmatrix_subv& v1, const scvector& v2) {
02909   return srvector(v1) - v2;
02910 }
02911 
02912 inline scvector operator-(const scmatrix_subv& v1, const scvector& v2) {
02913   return scvector(v1) - v2;
02914 }
02915 
02916 inline scvector operator-(const scmatrix_subv& v1, const srvector_slice& v2) {
02917   return scvector(v1) - v2;
02918 }
02919 
02920 inline scvector operator-(const srmatrix_subv& v1, const scvector_slice& v2) {
02921   return srvector(v1) - v2;
02922 }
02923 
02924 inline scvector operator-(const scmatrix_subv& v1, const scvector_slice& v2) {
02925   return scvector(v1) - v2;
02926 }
02927 
02928 inline cvector operator-(const scmatrix_subv& v1, const rvector& v2) {
02929   return scvector(v1) - v2;
02930 }
02931 
02932 inline cvector operator-(const srmatrix_subv& v1, const cvector& v2) {
02933   return srvector(v1) - v2;
02934 }
02935 
02936 inline cvector operator-(const scmatrix_subv& v1, const cvector& v2) {
02937   return scvector(v1) - v2;
02938 }
02939 
02940 inline cvector operator-(const scmatrix_subv& v1, const rvector_slice& v2) {
02941   return scvector(v1) - v2;
02942 }
02943 
02944 inline cvector operator-(const srmatrix_subv& v1, const cvector_slice& v2) {
02945   return srvector(v1) - v2;
02946 }
02947 
02948 inline cvector operator-(const scmatrix_subv& v1, const cvector_slice& v2) {
02949   return scvector(v1) - v2;
02950 }
02951 
02952 inline scvector operator-(const scvector& v1, const srmatrix_subv& v2) {
02953   return v1 - srvector(v2);
02954 }
02955 
02956 inline scvector operator-(const srvector& v1, const scmatrix_subv& v2) {
02957   return v1 - scvector(v2);
02958 }
02959 
02960 inline scvector operator-(const scvector& v1, const scmatrix_subv& v2) {
02961   return v1 - scvector(v2);
02962 }
02963 
02964 inline scvector operator-(const scvector_slice& v1, const srmatrix_subv& v2) {
02965   return v1 - srvector(v2);
02966 }
02967 
02968 inline scvector operator-(const srvector_slice& v1, const scmatrix_subv& v2) {
02969   return v1 - scvector(v2);
02970 }
02971 
02972 inline scvector operator-(const scvector_slice& v1, const scmatrix_subv& v2) {
02973   return v1 - scvector(v2);
02974 }
02975 
02976 inline cvector operator-(const cvector& v1, const srmatrix_subv& v2) {
02977   return v1 - srvector(v2);
02978 }
02979 
02980 inline cvector operator-(const rvector& v1, const scmatrix_subv& v2) {
02981   return v1 - scvector(v2);
02982 }
02983 
02984 inline cvector operator-(const cvector& v1, const scmatrix_subv& v2) {
02985   return v1 - scvector(v2);
02986 }
02987 
02988 inline cvector operator-(const cvector_slice& v1, const srmatrix_subv& v2) {
02989   return v1 - srvector(v2);
02990 }
02991 
02992 inline cvector operator-(const rvector_slice& v1, const scmatrix_subv& v2) {
02993   return v1 - scvector(v2);
02994 }
02995 
02996 inline cvector operator-(const cvector_slice& v1, const scmatrix_subv& v2) {
02997   return v1 - scvector(v2);
02998 }
02999 
03000 inline scmatrix_subv& scmatrix_subv::operator*=(const real& v) {
03001   *this = *this * v;
03002   return *this;
03003 }
03004 
03005 inline scmatrix_subv& scmatrix_subv::operator*=(const complex& v) {
03006   *this = *this * v;
03007   return *this;
03008 }
03009 
03010 inline scmatrix_subv& scmatrix_subv::operator/=(const real& v) {
03011   *this = *this / v;
03012   return *this;
03013 }
03014 
03015 inline scmatrix_subv& scmatrix_subv::operator/=(const complex& v) {
03016   *this = *this / v;
03017   return *this;
03018 }
03019 
03020 inline scmatrix_subv& scmatrix_subv::operator+=(const srvector& v) {
03021   *this = *this + v;
03022   return *this;
03023 }
03024 
03025 inline scmatrix_subv& scmatrix_subv::operator+=(const srvector_slice& v) {
03026   *this = *this + v;
03027   return *this;
03028 }
03029 
03030 inline scmatrix_subv& scmatrix_subv::operator+=(const rvector& v) {
03031   *this = *this + v;
03032   return *this;
03033 }
03034 
03035 inline scmatrix_subv& scmatrix_subv::operator+=(const rvector_slice& v) {
03036   *this = *this + v;
03037   return *this;
03038 }
03039 
03040 inline scmatrix_subv& scmatrix_subv::operator-=(const srvector& v) {
03041   *this = *this - v;
03042   return *this;
03043 }
03044 
03045 inline scmatrix_subv& scmatrix_subv::operator-=(const srvector_slice& v) {
03046   *this = *this - v;
03047   return *this;
03048 }
03049 
03050 inline scmatrix_subv& scmatrix_subv::operator-=(const rvector& v) {
03051   *this = *this - v;
03052   return *this;
03053 }
03054 
03055 inline scmatrix_subv& scmatrix_subv::operator-=(const rvector_slice& v) {
03056   *this = *this - v;
03057   return *this;
03058 }
03059 
03060 inline scmatrix_subv& scmatrix_subv::operator+=(const scvector& v) {
03061   *this = *this + v;
03062   return *this;
03063 }
03064 
03065 inline scmatrix_subv& scmatrix_subv::operator+=(const scvector_slice& v) {
03066   *this = *this + v;
03067   return *this;
03068 }
03069 
03070 inline scmatrix_subv& scmatrix_subv::operator+=(const cvector& v) {
03071   *this = *this + v;
03072   return *this;
03073 }
03074 
03075 inline scmatrix_subv& scmatrix_subv::operator+=(const cvector_slice& v) {
03076   *this = *this + v;
03077   return *this;
03078 }
03079 
03080 inline scmatrix_subv& scmatrix_subv::operator-=(const scvector& v) {
03081   *this = *this - v;
03082   return *this;
03083 }
03084 
03085 inline scmatrix_subv& scmatrix_subv::operator-=(const scvector_slice& v) {
03086   *this = *this - v;
03087   return *this;
03088 }
03089 
03090 inline scmatrix_subv& scmatrix_subv::operator-=(const cvector& v) {
03091   *this = *this - v;
03092   return *this;
03093 }
03094 
03095 inline scmatrix_subv& scmatrix_subv::operator-=(const cvector_slice& v) {
03096   *this = *this - v;
03097   return *this;
03098 }
03099 
03100 inline cmatrix_subv& cmatrix_subv::operator+=(const srmatrix_subv& v) {
03101   *this += rvector(v);
03102   return *this;
03103 }
03104 
03105 inline cmatrix_subv& cmatrix_subv::operator+=(const scmatrix_subv& v) {
03106   *this += cvector(v);
03107   return *this;
03108 }
03109 
03110 inline cmatrix_subv& cmatrix_subv::operator+=(const srvector& v) {
03111   *this += rvector(v);
03112   return *this;
03113 }
03114 
03115 inline cmatrix_subv& cmatrix_subv::operator+=(const scvector& v) {
03116   *this += cvector(v);
03117   return *this;
03118 }
03119 
03120 inline cmatrix_subv& cmatrix_subv::operator+=(const srvector_slice& v) {
03121   *this += rvector(v);
03122   return *this;
03123 }
03124 
03125 inline cmatrix_subv& cmatrix_subv::operator+=(const scvector_slice& v) {
03126   *this += cvector(v);
03127   return *this;
03128 }
03129 
03130 inline cmatrix_subv& cmatrix_subv::operator-=(const srmatrix_subv& v) {
03131   *this -= rvector(v);
03132   return *this;
03133 }
03134 
03135 inline cmatrix_subv& cmatrix_subv::operator-=(const scmatrix_subv& v) {
03136   *this -= cvector(v);
03137   return *this;
03138 }
03139 
03140 inline cmatrix_subv& cmatrix_subv::operator=(const srvector& v) {
03141   *this = rvector(v);
03142   return *this;
03143 }
03144 
03145 inline cmatrix_subv& cmatrix_subv::operator=(const scvector& v) {
03146   *this = cvector(v);
03147   return *this;
03148 }
03149 
03150 inline cmatrix_subv& cmatrix_subv::operator=(const srvector_slice& v) {
03151   *this = rvector(v);
03152   return *this;
03153 }
03154 
03155 inline cmatrix_subv& cmatrix_subv::operator=(const scvector_slice& v) {
03156   *this = cvector(v);
03157   return *this;
03158 }
03159 
03160 inline cmatrix_subv& cmatrix_subv::operator=(const srmatrix_subv& v) {
03161   *this = rvector(v);
03162   return *this;
03163 }
03164 
03165 inline cmatrix_subv& cmatrix_subv::operator=(const scmatrix_subv& v) {
03166   *this = cvector(v);
03167   return *this;
03168 }
03169 
03170 inline bool operator==(const scmatrix_subv& v1, const srvector& v2) {
03171   return scvector(v1) == v2;
03172 }
03173 
03174 inline bool operator==(const srmatrix_subv& v1, const scvector& v2) {
03175   return srvector(v1) == v2;
03176 }
03177 
03178 inline bool operator==(const scmatrix_subv& v1, const scvector& v2) {
03179   return scvector(v1) == v2;
03180 }
03181 
03182 inline bool operator==(const scmatrix_subv& v1, const srvector_slice& v2) {
03183   return scvector(v1) == v2;
03184 }
03185 
03186 inline bool operator==(const srmatrix_subv& v1, const scvector_slice& v2) {
03187   return srvector(v1) == v2;
03188 }
03189 
03190 inline bool operator==(const scmatrix_subv& v1, const scvector_slice& v2) {
03191   return scvector(v1) == v2;
03192 }
03193 
03194 inline bool operator==(const scmatrix_subv& v1, const rvector& v2) {
03195   return scvector(v1) == v2;
03196 }
03197 
03198 inline bool operator==(const srmatrix_subv& v1, const cvector& v2) {
03199   return srvector(v1) == v2;
03200 }
03201 
03202 inline bool operator==(const scmatrix_subv& v1, const cvector& v2) {
03203   return scvector(v1) == v2;
03204 }
03205 
03206 inline bool operator==(const scmatrix_subv& v1, const rvector_slice& v2) {
03207   return scvector(v1) == v2;
03208 }
03209 
03210 inline bool operator==(const srmatrix_subv& v1, const cvector_slice& v2) {
03211   return srvector(v1) == v2;
03212 }
03213 
03214 inline bool operator==(const scmatrix_subv& v1, const cvector_slice& v2) {
03215   return scvector(v1) == v2;
03216 }
03217 
03218 inline bool operator==(const scvector& v1, const srmatrix_subv& v2) {
03219   return v1 == srvector(v2);
03220 }
03221 
03222 inline bool operator==(const srvector& v1, const scmatrix_subv& v2) {
03223   return v1 == scvector(v2);
03224 }
03225 
03226 inline bool operator==(const scvector& v1, const scmatrix_subv& v2) {
03227   return v1 == scvector(v2);
03228 }
03229 
03230 inline bool operator==(const scvector_slice& v1, const srmatrix_subv& v2) {
03231   return v1 == srvector(v2);
03232 }
03233 
03234 inline bool operator==(const srvector_slice& v1, const scmatrix_subv& v2) {
03235   return v1 == scvector(v2);
03236 }
03237 
03238 inline bool operator==(const scvector_slice& v1, const scmatrix_subv& v2) {
03239   return v1 == scvector(v2);
03240 }
03241 
03242 inline bool operator==(const cvector& v1, const srmatrix_subv& v2) {
03243   return v1 == srvector(v2);
03244 }
03245 
03246 inline bool operator==(const rvector& v1, const scmatrix_subv& v2) {
03247   return v1 == scvector(v2);
03248 }
03249 
03250 inline bool operator==(const cvector& v1, const scmatrix_subv& v2) {
03251   return v1 == scvector(v2);
03252 }
03253 
03254 inline bool operator==(const cvector_slice& v1, const srmatrix_subv& v2) {
03255   return v1 == srvector(v2);
03256 }
03257 
03258 inline bool operator==(const rvector_slice& v1, const scmatrix_subv& v2) {
03259   return v1 == scvector(v2);
03260 }
03261 
03262 inline bool operator==(const cvector_slice& v1, const scmatrix_subv& v2) {
03263   return v1 == scvector(v2);
03264 }
03265 
03266 inline bool operator!=(const scmatrix_subv& v1, const srvector& v2) {
03267   return scvector(v1) != v2;
03268 }
03269 
03270 inline bool operator!=(const srmatrix_subv& v1, const scvector& v2) {
03271   return srvector(v1) != v2;
03272 }
03273 
03274 inline bool operator!=(const scmatrix_subv& v1, const scvector& v2) {
03275   return scvector(v1) != v2;
03276 }
03277 
03278 inline bool operator!=(const scmatrix_subv& v1, const srvector_slice& v2) {
03279   return scvector(v1) != v2;
03280 }
03281 
03282 inline bool operator!=(const srmatrix_subv& v1, const scvector_slice& v2) {
03283   return srvector(v1) != v2;
03284 }
03285 
03286 inline bool operator!=(const scmatrix_subv& v1, const scvector_slice& v2) {
03287   return scvector(v1) != v2;
03288 }
03289 
03290 inline bool operator!=(const scmatrix_subv& v1, const rvector& v2) {
03291   return scvector(v1) != v2;
03292 }
03293 
03294 inline bool operator!=(const srmatrix_subv& v1, const cvector& v2) {
03295   return srvector(v1) != v2;
03296 }
03297 
03298 inline bool operator!=(const scmatrix_subv& v1, const cvector& v2) {
03299   return scvector(v1) != v2;
03300 }
03301 
03302 inline bool operator!=(const scmatrix_subv& v1, const rvector_slice& v2) {
03303   return scvector(v1) != v2;
03304 }
03305 
03306 inline bool operator!=(const srmatrix_subv& v1, const cvector_slice& v2) {
03307   return srvector(v1) != v2;
03308 }
03309 
03310 inline bool operator!=(const scmatrix_subv& v1, const cvector_slice& v2) {
03311   return scvector(v1) != v2;
03312 }
03313 
03314 inline bool operator!=(const scvector& v1, const srmatrix_subv& v2) {
03315   return v1 != srvector(v2);
03316 }
03317 
03318 inline bool operator!=(const srvector& v1, const scmatrix_subv& v2) {
03319   return v1 != scvector(v2);
03320 }
03321 
03322 inline bool operator!=(const scvector& v1, const scmatrix_subv& v2) {
03323   return v1 != scvector(v2);
03324 }
03325 
03326 inline bool operator!=(const scvector_slice& v1, const srmatrix_subv& v2) {
03327   return v1 != srvector(v2);
03328 }
03329 
03330 inline bool operator!=(const srvector_slice& v1, const scmatrix_subv& v2) {
03331   return v1 != scvector(v2);
03332 }
03333 
03334 inline bool operator!=(const scvector_slice& v1, const scmatrix_subv& v2) {
03335   return v1 != scvector(v2);
03336 }
03337 
03338 inline bool operator!=(const cvector& v1, const srmatrix_subv& v2) {
03339   return v1 != srvector(v2);
03340 }
03341 
03342 inline bool operator!=(const rvector& v1, const scmatrix_subv& v2) {
03343   return v1 != scvector(v2);
03344 }
03345 
03346 inline bool operator!=(const cvector& v1, const scmatrix_subv& v2) {
03347   return v1 != scvector(v2);
03348 }
03349 
03350 inline bool operator!=(const cvector_slice& v1, const srmatrix_subv& v2) {
03351   return v1 != srvector(v2);
03352 }
03353 
03354 inline bool operator!=(const rvector_slice& v1, const scmatrix_subv& v2) {
03355   return v1 != scvector(v2);
03356 }
03357 
03358 inline bool operator!=(const cvector_slice& v1, const scmatrix_subv& v2) {
03359   return v1 != scvector(v2);
03360 }
03361 
03362 inline bool operator!(const scmatrix_subv& x) {
03363   return sv_v_not(x);
03364 }
03365 
03366 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const scmatrix_subv& v2) {
03367   spsp_vv_accu<cdotprecision,scvector,scvector,sparse_cdot>(dot, scvector(v1), scvector(v2));
03368 }
03369 
03370 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const srmatrix_subv& v2) {
03371   spsp_vv_accu<cdotprecision,scvector,srvector,sparse_cdot>(dot, scvector(v1), srvector(v2));
03372 }
03373 
03374 inline void accumulate(cdotprecision& dot, const srmatrix_subv& v1, const scmatrix_subv& v2) {
03375   spsp_vv_accu<cdotprecision,srvector,scvector,sparse_cdot>(dot, srvector(v1), scvector(v2));
03376 }
03377 
03378 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const scvector& v2) {
03379   spsp_vv_accu<cdotprecision,scvector,scvector,sparse_cdot>(dot, scvector(v1), v2);
03380 }
03381 
03382 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const srvector& v2) {
03383   spsp_vv_accu<cdotprecision,scvector,srvector,sparse_cdot>(dot, scvector(v1), v2);
03384 }
03385 
03386 inline void accumulate(cdotprecision& dot, const srmatrix_subv& v1, const scvector& v2) {
03387   spsp_vv_accu<cdotprecision,srvector,scvector,sparse_cdot>(dot, srvector(v1), v2);
03388 }
03389 
03390 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const scvector_slice& v2) {
03391   spsl_vv_accu<cdotprecision,scvector,scvector_slice,sparse_cdot>(dot, scvector(v1), v2);
03392 }
03393 
03394 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const srvector_slice& v2) {
03395   spsl_vv_accu<cdotprecision,scvector,srvector_slice,sparse_cdot>(dot, scvector(v1), v2);
03396 }
03397 
03398 inline void accumulate(cdotprecision& dot, const srmatrix_subv& v1, const scvector_slice& v2) {
03399   spsl_vv_accu<cdotprecision,srvector,scvector_slice,sparse_cdot>(dot, srvector(v1), v2);
03400 }
03401 
03402 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const cvector& v2) {
03403   spf_vv_accu<cdotprecision,scvector,cvector,sparse_cdot>(dot, scvector(v1), v2);
03404 }
03405 
03406 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const rvector& v2) {
03407   spf_vv_accu<cdotprecision,scvector,rvector,sparse_cdot>(dot, scvector(v1), v2);
03408 }
03409 
03410 inline void accumulate(cdotprecision& dot, const srmatrix_subv& v1, const cvector& v2) {
03411   spf_vv_accu<cdotprecision,srvector,cvector,sparse_cdot>(dot, srvector(v1), v2);
03412 }
03413 
03414 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const cvector_slice& v2) {
03415   spf_vv_accu<cdotprecision,scvector,cvector_slice,sparse_cdot>(dot, scvector(v1), v2);
03416 }
03417 
03418 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const rvector_slice& v2) {
03419   spf_vv_accu<cdotprecision,scvector,rvector_slice,sparse_cdot>(dot, scvector(v1), v2);
03420 }
03421 
03422 inline void accumulate(cdotprecision& dot, const srmatrix_subv& v1, const cvector_slice& v2) {
03423   spf_vv_accu<cdotprecision,srvector,cvector_slice,sparse_cdot>(dot, srvector(v1), v2);
03424 }
03425 
03426 inline void accumulate(cdotprecision& dot, const scvector& v1, const scmatrix_subv& v2) {
03427   spsp_vv_accu<cdotprecision,scvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
03428 }
03429 
03430 inline void accumulate(cdotprecision& dot, const scvector& v1, const srmatrix_subv& v2) {
03431   spsp_vv_accu<cdotprecision,scvector,srvector,sparse_cdot>(dot, v1, srvector(v2));
03432 }
03433 
03434 inline void accumulate(cdotprecision& dot, const srvector& v1, const scmatrix_subv& v2) {
03435   spsp_vv_accu<cdotprecision,srvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
03436 }
03437 
03438 inline void accumulate(cdotprecision& dot, const scvector_slice& v1, const scmatrix_subv& v2) {
03439   slsp_vv_accu<cdotprecision,scvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
03440 }
03441 
03442 inline void accumulate(cdotprecision& dot, const scvector_slice& v1, const srmatrix_subv& v2) {
03443   slsp_vv_accu<cdotprecision,scvector_slice,srvector,sparse_cdot>(dot, v1, srvector(v2));
03444 }
03445 
03446 inline void accumulate(cdotprecision& dot, const srvector_slice& v1, const scmatrix_subv& v2) {
03447   slsp_vv_accu<cdotprecision,srvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
03448 }
03449 
03450 inline void accumulate(cdotprecision& dot, const cvector& v1, const scmatrix_subv& v2) {
03451   fsp_vv_accu<cdotprecision,cvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
03452 }
03453 
03454 inline void accumulate(cdotprecision& dot, const cvector& v1, const srmatrix_subv& v2) {
03455   fsp_vv_accu<cdotprecision,cvector,srvector,sparse_cdot>(dot, v1, srvector(v2));
03456 }
03457 
03458 inline void accumulate(cdotprecision& dot, const rvector& v1, const scmatrix_subv& v2) {
03459   fsp_vv_accu<cdotprecision,rvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
03460 }
03461 
03462 inline void accumulate(cdotprecision& dot, const cvector_slice& v1, const scmatrix_subv& v2) {
03463   fsp_vv_accu<cdotprecision,cvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
03464 }
03465 
03466 inline void accumulate(cdotprecision& dot, const cvector_slice& v1, const srmatrix_subv& v2) {
03467   fsp_vv_accu<cdotprecision,cvector_slice,srvector,sparse_cdot>(dot, v1, srvector(v2));
03468 }
03469 
03470 inline void accumulate(cdotprecision& dot, const rvector_slice& v1, const scmatrix_subv& v2) {
03471   fsp_vv_accu<cdotprecision,rvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
03472 }
03473 
03474 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const scmatrix_subv& v2) {
03475   spsp_vv_accuapprox<cdotprecision,scvector,scvector,sparse_cdot>(dot, scvector(v1), scvector(v2));
03476 }
03477 
03478 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const srmatrix_subv& v2) {
03479   spsp_vv_accuapprox<cdotprecision,scvector,srvector,sparse_cdot>(dot, scvector(v1), srvector(v2));
03480 }
03481 
03482 inline void accumulate_approx(cdotprecision& dot, const srmatrix_subv& v1, const scmatrix_subv& v2) {
03483   spsp_vv_accuapprox<cdotprecision,srvector,scvector,sparse_cdot>(dot, srvector(v1), scvector(v2));
03484 }
03485 
03486 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const scvector& v2) {
03487   spsp_vv_accuapprox<cdotprecision,scvector,scvector,sparse_cdot>(dot, scvector(v1), v2);
03488 }
03489 
03490 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const srvector& v2) {
03491   spsp_vv_accuapprox<cdotprecision,scvector,srvector,sparse_cdot>(dot, scvector(v1), v2);
03492 }
03493 
03494 inline void accumulate_approx(cdotprecision& dot, const srmatrix_subv& v1, const scvector& v2) {
03495   spsp_vv_accuapprox<cdotprecision,srvector,scvector,sparse_cdot>(dot, srvector(v1), v2);
03496 }
03497 
03498 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const scvector_slice& v2) {
03499   spsl_vv_accuapprox<cdotprecision,scvector,scvector_slice,sparse_cdot>(dot, scvector(v1), v2);
03500 }
03501 
03502 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const srvector_slice& v2) {
03503   spsl_vv_accuapprox<cdotprecision,scvector,srvector_slice,sparse_cdot>(dot, scvector(v1), v2);
03504 }
03505 
03506 inline void accumulate_approx(cdotprecision& dot, const srmatrix_subv& v1, const scvector_slice& v2) {
03507   spsl_vv_accuapprox<cdotprecision,srvector,scvector_slice,sparse_cdot>(dot, srvector(v1), v2);
03508 }
03509 
03510 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const cvector& v2) {
03511   spf_vv_accuapprox<cdotprecision,scvector,cvector,sparse_cdot>(dot, scvector(v1), v2);
03512 }
03513 
03514 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const rvector& v2) {
03515   spf_vv_accuapprox<cdotprecision,scvector,rvector,sparse_cdot>(dot, scvector(v1), v2);
03516 }
03517 
03518 inline void accumulate_approx(cdotprecision& dot, const srmatrix_subv& v1, const cvector& v2) {
03519   spf_vv_accuapprox<cdotprecision,srvector,cvector,sparse_cdot>(dot, srvector(v1), v2);
03520 }
03521 
03522 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const cvector_slice& v2) {
03523   spf_vv_accuapprox<cdotprecision,scvector,cvector_slice,sparse_cdot>(dot, scvector(v1), v2);
03524 }
03525 
03526 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const rvector_slice& v2) {
03527   spf_vv_accuapprox<cdotprecision,scvector,rvector_slice,sparse_cdot>(dot, scvector(v1), v2);
03528 }
03529 
03530 inline void accumulate_approx(cdotprecision& dot, const srmatrix_subv& v1, const cvector_slice& v2) {
03531   spf_vv_accuapprox<cdotprecision,srvector,cvector_slice,sparse_cdot>(dot, srvector(v1), v2);
03532 }
03533 
03534 inline void accumulate_approx(cdotprecision& dot, const scvector& v1, const scmatrix_subv& v2) {
03535   spsp_vv_accuapprox<cdotprecision,scvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
03536 }
03537 
03538 inline void accumulate_approx(cdotprecision& dot, const scvector& v1, const srmatrix_subv& v2) {
03539   spsp_vv_accuapprox<cdotprecision,scvector,srvector,sparse_cdot>(dot, v1, srvector(v2));
03540 }
03541 
03542 inline void accumulate_approx(cdotprecision& dot, const srvector& v1, const scmatrix_subv& v2) {
03543   spsp_vv_accuapprox<cdotprecision,srvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
03544 }
03545 
03546 inline void accumulate_approx(cdotprecision& dot, const scvector_slice& v1, const scmatrix_subv& v2) {
03547   slsp_vv_accuapprox<cdotprecision,scvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
03548 }
03549 
03550 inline void accumulate_approx(cdotprecision& dot, const scvector_slice& v1, const srmatrix_subv& v2) {
03551   slsp_vv_accuapprox<cdotprecision,scvector_slice,srvector,sparse_cdot>(dot, v1, srvector(v2));
03552 }
03553 
03554 inline void accumulate_approx(cdotprecision& dot, const srvector_slice& v1, const scmatrix_subv& v2) {
03555   slsp_vv_accuapprox<cdotprecision,srvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
03556 }
03557 
03558 inline void accumulate_approx(cdotprecision& dot, const cvector& v1, const scmatrix_subv& v2) {
03559   fsp_vv_accuapprox<cdotprecision,cvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
03560 }
03561 
03562 inline void accumulate_approx(cdotprecision& dot, const cvector& v1, const srmatrix_subv& v2) {
03563   fsp_vv_accuapprox<cdotprecision,cvector,srvector,sparse_cdot>(dot, v1, srvector(v2));
03564 }
03565 
03566 inline void accumulate_approx(cdotprecision& dot, const rvector& v1, const scmatrix_subv& v2) {
03567   fsp_vv_accuapprox<cdotprecision,rvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
03568 }
03569 
03570 inline void accumulate_approx(cdotprecision& dot, const cvector_slice& v1, const scmatrix_subv& v2) {
03571   fsp_vv_accuapprox<cdotprecision,cvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
03572 }
03573 
03574 inline void accumulate_approx(cdotprecision& dot, const cvector_slice& v1, const srmatrix_subv& v2) {
03575   fsp_vv_accuapprox<cdotprecision,cvector_slice,srvector,sparse_cdot>(dot, v1, srvector(v2));
03576 }
03577 
03578 inline void accumulate_approx(cdotprecision& dot, const rvector_slice& v1, const scmatrix_subv& v2) {
03579   fsp_vv_accuapprox<cdotprecision,rvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
03580 }
03581 
03582 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const scmatrix_subv& v2) {
03583   cdotprecision tmp(0.0);
03584   tmp.set_k(dot.get_k());
03585   accumulate(tmp,scvector(v1),scvector(v2));
03586   dot += tmp;
03587 }
03588 
03589 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const srmatrix_subv& v2) {
03590   cdotprecision tmp(0.0);
03591   tmp.set_k(dot.get_k());
03592   accumulate(tmp,scvector(v1),srvector(v2));
03593   dot += tmp;
03594 }
03595 
03596 inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const scmatrix_subv& v2) {
03597   cdotprecision tmp(0.0);
03598   tmp.set_k(dot.get_k());
03599   accumulate(tmp,srvector(v1),scvector(v2));
03600   dot += tmp;
03601 }
03602 
03603 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const scvector& v2) {
03604   cdotprecision tmp(0.0);
03605   tmp.set_k(dot.get_k());
03606   accumulate(tmp,scvector(v1),v2);
03607   dot += tmp;
03608 }
03609 
03610 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const srvector& v2) {
03611   cdotprecision tmp(0.0);
03612   tmp.set_k(dot.get_k());
03613   accumulate(tmp,scvector(v1),v2);
03614   dot += tmp;
03615 }
03616 
03617 inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const scvector& v2) {
03618   cdotprecision tmp(0.0);
03619   tmp.set_k(dot.get_k());
03620   accumulate(tmp,srvector(v1),v2);
03621   dot += tmp;
03622 }
03623 
03624 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const scvector_slice& v2) {
03625   cdotprecision tmp(0.0);
03626   tmp.set_k(dot.get_k());
03627   accumulate(tmp,scvector(v1),v2);
03628   dot += tmp;
03629 }
03630 
03631 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const srvector_slice& v2) {
03632   cdotprecision tmp(0.0);
03633   tmp.set_k(dot.get_k());
03634   accumulate(tmp,scvector(v1),v2);
03635   dot += tmp;
03636 }
03637 
03638 inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const scvector_slice& v2) {
03639   cdotprecision tmp(0.0);
03640   tmp.set_k(dot.get_k());
03641   accumulate(tmp,srvector(v1),v2);
03642   dot += tmp;
03643 }
03644 
03645 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const cvector& v2) {
03646   cdotprecision tmp(0.0);
03647   tmp.set_k(dot.get_k());
03648   accumulate(tmp,scvector(v1),v2);
03649   dot += tmp;
03650 }
03651 
03652 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const rvector& v2) {
03653   cdotprecision tmp(0.0);
03654   tmp.set_k(dot.get_k());
03655   accumulate(tmp,scvector(v1),v2);
03656   dot += tmp;
03657 }
03658 
03659 inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const cvector& v2) {
03660   cdotprecision tmp(0.0);
03661   tmp.set_k(dot.get_k());
03662   accumulate(tmp,srvector(v1),v2);
03663   dot += tmp;
03664 }
03665 
03666 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const cvector_slice& v2) {
03667   cdotprecision tmp(0.0);
03668   tmp.set_k(dot.get_k());
03669   accumulate(tmp,scvector(v1),v2);
03670   dot += tmp;
03671 }
03672 
03673 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const rvector_slice& v2) {
03674   cdotprecision tmp(0.0);
03675   tmp.set_k(dot.get_k());
03676   accumulate(tmp,scvector(v1),v2);
03677   dot += tmp;
03678 }
03679 
03680 inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const cvector_slice& v2) {
03681   cdotprecision tmp(0.0);
03682   tmp.set_k(dot.get_k());
03683   accumulate(tmp,srvector(v1),v2);
03684   dot += tmp;
03685 }
03686 
03687 inline void accumulate(cidotprecision& dot, const scvector& v1, const scmatrix_subv& v2) {
03688   cdotprecision tmp(0.0);
03689   tmp.set_k(dot.get_k());
03690   accumulate(tmp,v1,scvector(v2));
03691   dot += tmp;
03692 }
03693 
03694 inline void accumulate(cidotprecision& dot, const scvector& v1, const srmatrix_subv& v2) {
03695   cdotprecision tmp(0.0);
03696   tmp.set_k(dot.get_k());
03697   accumulate(tmp,v1,srvector(v2));
03698   dot += tmp;
03699 }
03700 
03701 inline void accumulate(cidotprecision& dot, const srvector& v1, const scmatrix_subv& v2) {
03702   cdotprecision tmp(0.0);
03703   tmp.set_k(dot.get_k());
03704   accumulate(tmp,v1,scvector(v2));
03705   dot += tmp;
03706 }
03707 
03708 inline void accumulate(cidotprecision& dot, const scvector_slice& v1, const scmatrix_subv& v2) {
03709   cdotprecision tmp(0.0);
03710   tmp.set_k(dot.get_k());
03711   accumulate(tmp,v1,scvector(v2));
03712   dot += tmp;
03713 }
03714 
03715 inline void accumulate(cidotprecision& dot, const scvector_slice& v1, const srmatrix_subv& v2) {
03716   cdotprecision tmp(0.0);
03717   tmp.set_k(dot.get_k());
03718   accumulate(tmp,v1,srvector(v2));
03719   dot += tmp;
03720 }
03721 
03722 inline void accumulate(cidotprecision& dot, const srvector_slice& v1, const scmatrix_subv& v2) {
03723   cdotprecision tmp(0.0);
03724   tmp.set_k(dot.get_k());
03725   accumulate(tmp,v1,scvector(v2));
03726   dot += tmp;
03727 }
03728 
03729 inline void accumulate(cidotprecision& dot, const cvector& v1, const scmatrix_subv& v2) {
03730   cdotprecision tmp(0.0);
03731   tmp.set_k(dot.get_k());
03732   accumulate(tmp,v1,scvector(v2));
03733   dot += tmp;
03734 }
03735 
03736 inline void accumulate(cidotprecision& dot, const cvector& v1, const srmatrix_subv& v2) {
03737   cdotprecision tmp(0.0);
03738   tmp.set_k(dot.get_k());
03739   accumulate(tmp,v1,srvector(v2));
03740   dot += tmp;
03741 }
03742 
03743 inline void accumulate(cidotprecision& dot, const rvector& v1, const scmatrix_subv& v2) {
03744   cdotprecision tmp(0.0);
03745   tmp.set_k(dot.get_k());
03746   accumulate(tmp,v1,scvector(v2));
03747   dot += tmp;
03748 }
03749 
03750 inline void accumulate(cidotprecision& dot, const cvector_slice& v1, const scmatrix_subv& v2) {
03751   cdotprecision tmp(0.0);
03752   tmp.set_k(dot.get_k());
03753   accumulate(tmp,v1,scvector(v2));
03754   dot += tmp;
03755 }
03756 
03757 inline void accumulate(cidotprecision& dot, const cvector_slice& v1, const srmatrix_subv& v2) {
03758   cdotprecision tmp(0.0);
03759   tmp.set_k(dot.get_k());
03760   accumulate(tmp,v1,srvector(v2));
03761   dot += tmp;
03762 }
03763 
03764 inline void accumulate(cidotprecision& dot, const rvector_slice& v1, const scmatrix_subv& v2) {
03765   cdotprecision tmp(0.0);
03766   tmp.set_k(dot.get_k());
03767   accumulate(tmp,v1,scvector(v2));
03768   dot += tmp;
03769 }
03770 
03771 }  //namespace cxsc;
03772 
03773 #include "sparsematrix.inl"
03774 
03775 #endif 
03776  

Generated on Thu Jun 9 11:22:07 2011 for C-XSC - A C++ Class Library for Extended Scientific Computing by  doxygen 1.4.6