C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
scmatrix.hpp
00001 /*
00002 **  CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4)
00003 **
00004 **  Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
00005 **                          Universitaet Karlsruhe, Germany
00006 **            (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie
00007 **                          Universitaet Wuppertal, Germany   
00008 **
00009 **  This library is free software; you can redistribute it and/or
00010 **  modify it under the terms of the GNU Library General Public
00011 **  License as published by the Free Software Foundation; either
00012 **  version 2 of the License, or (at your option) any later version.
00013 **
00014 **  This library is distributed in the hope that it will be useful,
00015 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 **  Library General Public License for more details.
00018 **
00019 **  You should have received a copy of the GNU Library General Public
00020 **  License along with this library; if not, write to the Free
00021 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 */
00023 
00024 /* CVS $Id: scmatrix.hpp,v 1.20 2014/01/30 17:23:48 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 
00057 
00069 class scmatrix {
00070 
00071   private:
00072     std::vector<int> p;
00073     std::vector<int> ind;
00074     std::vector<complex> x;
00075     int m;
00076     int n;
00077     int lb1,ub1,lb2,ub2;
00078 
00079   public:
00080 
00082     std::vector<int>& column_pointers() {
00083       return p;
00084     }
00085 
00087     std::vector<int>& row_indices() {
00088       return ind;
00089     }
00090 
00092     std::vector<complex>& values() {
00093       return x;
00094     }
00095 
00097     const std::vector<int>& column_pointers() const {
00098       return p;
00099     }
00100 
00102     const std::vector<int>& row_indices() const {
00103       return ind;
00104     }
00105 
00107     const std::vector<complex>& values() const {
00108       return x;
00109     }
00110 
00112     scmatrix() {
00113       p.push_back(0);
00114       m = n = 0;
00115       lb1 = lb2 = ub1 = ub2 = 0;
00116     }
00117 
00119     scmatrix(const int r, const int c) : m(r),n(c),lb1(1),ub1(r),lb2(1),ub2(c) {
00120       p = std::vector<int>((n>0) ? n+1 : 1, 0);
00121       ind.reserve(2*(m+n));
00122       x.reserve(2*(m+n));
00123 
00124       p[0] = 0;
00125     }
00126 
00128     scmatrix(const int r, const int c, const int e) : m(r),n(c),lb1(1),ub1(r),lb2(1),ub2(c) {
00129       p = std::vector<int>((n>0) ? n+1 : 1, 0);
00130       ind.reserve(e);
00131       x.reserve(e);
00132 
00133       p[0] = 0;
00134     }
00135 
00137 
00143     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) {
00144       if(t == triplet) {
00145          this->m = m;
00146          this->n = n;
00147          p = std::vector<int>(n+1,0);
00148          ind.reserve(nnz);
00149          x.reserve(nnz);
00150          lb1 = lb2 = 1;
00151          ub1 = m; ub2 = n;
00152 
00153          std::vector<triplet_store<complex> > work;
00154          work.reserve(nnz);
00155 
00156          for(int k=0 ; k<nnz ; k++) {
00157            work.push_back(triplet_store<complex>(rows[Lb(rows)+k],cols[Lb(cols)+k],values[Lb(values)+k]));
00158          }
00159 
00160          sort(work.begin(), work.end());
00161 
00162          int i=0;
00163 
00164          for(int j=0 ; j<n ; j++) {        
00165 
00166            while((unsigned int)i < work.size() && work[i].col == j ) {
00167                ind.push_back(work[i].row);
00168                x.push_back(work[i].val);
00169                i++;
00170            }
00171 
00172            p[j+1] = i;
00173          }
00174          
00175       } else if(t == compressed_row) {
00176 
00177          this->m = m;
00178          this->n = n;
00179          p = std::vector<int>(n+1,0);
00180          ind.reserve(nnz);
00181          x.reserve(nnz);
00182          lb1 = lb2 = 1;
00183          ub1 = m; ub2 = n;
00184 
00185          for(int i=0 ; i<n+1 ; i++)
00186            p[i] = rows[Lb(rows)+i];
00187 
00188          std::vector<triplet_store<complex> > work;
00189          work.reserve(nnz);
00190 
00191          for(int j=0 ; j<n ; j++) {
00192            for(int k=p[j] ; k<p[j+1] ; k++) {
00193              work.push_back(triplet_store<complex>(j,cols[Lb(cols)+k],values[Lb(values)+k]));
00194            }
00195          }
00196 
00197          sort(work.begin(), work.end());
00198 
00199          int i=0;
00200 
00201          for(int j=0 ; j<n ; j++) {        
00202 
00203            while((unsigned int)i < work.size() && work[i].col == j ) {
00204                ind.push_back(work[i].row);
00205                x.push_back(work[i].val);
00206                i++;
00207            }
00208 
00209            p[j+1] = i;
00210          }
00211     
00212       } else if(t == compressed_column) {
00213          this->m = m;
00214          this->n = n;
00215          p = std::vector<int>(n+1,0);
00216          ind.reserve(nnz);
00217          x.reserve(nnz);
00218          lb1 = lb2 = 1;
00219          ub1 = m; ub2 = n;
00220 
00221          for(int i=0 ; i<n+1 ; i++)
00222            p[i] = rows[Lb(rows)+i];
00223 
00224          std::vector<std::pair<int,complex> > work;
00225          work.reserve(n);
00226 
00227          for(int j=0 ; j<n ; j++) {
00228            work.clear();
00229 
00230            for(int k=p[j] ; k<p[j+1] ; k++) {
00231              work.push_back(std::make_pair(cols[Lb(cols)+k],values[Lb(values)+k]));
00232            }
00233 
00234            std::sort(work.begin(),work.end(),comp_pair_c);
00235 
00236            for(unsigned int i=0 ; i<work.size() ; i++) {
00237              ind.push_back(work[i].first);
00238              x.push_back(work[i].second);
00239            }
00240          }
00241 
00242       }
00243 
00244     }
00245 
00247 
00254     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) {
00255       if(t == triplet) {
00256          this->m = m;
00257          this->n = n;
00258          p = std::vector<int>(n+1,0);
00259          ind.reserve(nnz);
00260          x.reserve(nnz);
00261          lb1 = lb2 = 1;
00262          ub1 = m; ub2 = n;
00263 
00264          std::vector<triplet_store<complex> > work;
00265          work.reserve(nnz);
00266 
00267          for(int k=0 ; k<nnz ; k++) {
00268            work.push_back(triplet_store<complex>(rows[k],cols[k],values[k]));
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_row) {
00287 
00288          this->m = m;
00289          this->n = n;
00290          p = std::vector<int>(n+1,0);
00291          ind.reserve(nnz);
00292          x.reserve(nnz);
00293          lb1 = lb2 = 1;
00294          ub1 = m; ub2 = n;
00295 
00296          for(int i=0 ; i<n+1 ; i++)
00297            p[i] = rows[i];
00298 
00299          std::vector<triplet_store<complex> > work;
00300          work.reserve(nnz);
00301 
00302          for(int j=0 ; j<n ; j++) {
00303            for(int k=p[j] ; k<p[j+1] ; k++) {
00304              work.push_back(triplet_store<complex>(j,cols[k],values[k]));
00305            }
00306          }
00307 
00308          sort(work.begin(), work.end());
00309 
00310          int i=0;
00311 
00312          for(int j=0 ; j<n ; j++) {        
00313 
00314            while((unsigned int)i < work.size() && work[i].col == j ) {
00315                ind.push_back(work[i].row);
00316                x.push_back(work[i].val);
00317                i++;
00318            }
00319 
00320            p[j+1] = i;
00321          }
00322     
00323       } else if(t == compressed_column) {
00324          this->m = m;
00325          this->n = n;
00326          p = std::vector<int>(n+1,0);
00327          ind.reserve(nnz);
00328          x.reserve(nnz);
00329          lb1 = lb2 = 1;
00330          ub1 = m; ub2 = n;
00331 
00332          for(int i=0 ; i<n+1 ; i++)
00333            p[i] = rows[i];
00334 
00335          std::vector<std::pair<int,complex> > work;
00336          work.reserve(n);
00337 
00338          for(int j=0 ; j<n ; j++) {
00339            work.clear();
00340 
00341            for(int k=p[j] ; k<p[j+1] ; k++) {
00342              work.push_back(std::make_pair(cols[k],values[k]));
00343            }
00344 
00345            std::sort(work.begin(),work.end(),comp_pair_c);
00346 
00347            for(unsigned int i=0 ; i<work.size() ; i++) {
00348              ind.push_back(work[i].first);
00349              x.push_back(work[i].second);
00350            }
00351          }
00352 
00353       }
00354 
00355     }
00356 
00357 
00359     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) {
00360       x.reserve(A.get_nnz());
00361       for(unsigned int i=0 ; i<A.x.size() ; i++)
00362         x.push_back(complex(A.x[i]));
00363     }
00364 
00365 
00367     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)) {
00368       p = std::vector<int>((n>0) ? n+1 : 1, 0);
00369       ind.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
00370       x.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
00371 
00372       p[0] = 0;
00373       int nnz = 0;
00374 
00375       for(int j=0 ; j<n ; j++) {
00376         for(int i=0 ; i<m ; i++) {
00377           if(A[i+lb1][j+lb2] != 0.0) {
00378              ind.push_back(i);
00379              x.push_back(complex(A[i+lb1][j+lb2]));
00380              nnz++;
00381           }
00382         }
00383           
00384         p[j+1] = nnz;
00385       }
00386 
00387     }
00388 
00390     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)) {
00391       p = std::vector<int>((n>0) ? n+1 : 1, 0);
00392       ind.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
00393       x.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
00394 
00395       p[0] = 0;
00396       int nnz = 0;
00397 
00398       for(int j=0 ; j<n ; j++) {
00399         for(int i=0 ; i<m ; i++) {
00400           if(A[i+lb1][j+lb2] != 0.0) {
00401              ind.push_back(i);
00402              x.push_back(complex(A[i+lb1][j+lb2]));
00403              nnz++;
00404           }
00405         }
00406           
00407         p[j+1] = nnz;
00408       }
00409 
00410     }
00411 
00413 
00416     scmatrix(const int ms, const int ns, const cmatrix& A) : m(ms), n(ns), lb1(1), ub1(ms), lb2(1), ub2(ns)  {
00417       //Banded matrix constructor
00418       int nnz = RowLen(A)*ColLen(A);
00419       p = std::vector<int>((n>0) ? n+1 : 1, 0);
00420       ind.reserve(nnz);
00421       x.reserve(nnz);
00422 
00423       std::vector<triplet_store<complex> > work;
00424       work.reserve(nnz);
00425 
00426       
00427       for(int i=0 ; i<ColLen(A) ; i++) {
00428         for(int j=Lb(A,2) ; j<=Ub(A,2) ; j++) {
00429           if(i+j >=0  &&  i+j < n) {
00430             work.push_back(triplet_store<complex>(i,i+j,A[i+Lb(A,1)][j]));
00431           }
00432         }
00433       }
00434 
00435       sort(work.begin(), work.end());
00436 
00437       int i=0;
00438 
00439       for(int j=0 ; j<n ; j++) {        
00440 
00441         while((unsigned int)i < work.size() && work[i].col == j ) {
00442           ind.push_back(work[i].row);
00443           x.push_back(work[i].val);
00444           i++;
00445         }
00446 
00447         p[j+1] = i;
00448       }
00449 
00450     }
00451 
00453     scmatrix(const srmatrix_slice&);
00455     scmatrix(const scmatrix_slice&);
00456 
00458     void full(cmatrix& A) const {
00459        A = cmatrix(lb1,ub1,lb2,ub2);
00460        A = 0.0;
00461        for(int j=0 ; j<n ; j++) {
00462           for(int k=p[j] ; k<p[j+1] ; k++) {
00463              A[ind[k]+lb1][j+lb2] = x[k];
00464           }
00465        }
00466     }
00467 
00469 
00473     void dropzeros() {
00474       std::vector<int> pnew(n+1,0);
00475       std::vector<int> indnew;
00476       std::vector<complex> xnew;
00477       int nnznew = 0;
00478 
00479       for(int j=0 ; j<n ; j++) {
00480         for(int k=p[j] ; k<p[j+1] ; k++) {
00481           if(x[k] != 0.0) {
00482             xnew.push_back(x[k]);
00483             indnew.push_back(ind[k]);
00484             nnznew++;
00485           }
00486         }
00487         pnew[j+1] = nnznew;
00488       }
00489 
00490       p = pnew;
00491       ind = indnew;
00492       x = xnew;
00493     }
00494 
00495 
00497     scmatrix& operator=(const real& A) {
00498       return sp_ms_assign<scmatrix,real,complex>(*this,A);
00499     }
00500 
00502     scmatrix& operator=(const complex& A) {
00503       return sp_ms_assign<scmatrix,complex,complex>(*this,A);
00504     }
00505 
00507     scmatrix& operator=(const rmatrix& A) {
00508       return spf_mm_assign<scmatrix,rmatrix,complex>(*this,A);
00509     }
00510 
00512     scmatrix& operator=(const cmatrix& A) {
00513       return spf_mm_assign<scmatrix,cmatrix,complex>(*this,A);
00514     }
00515 
00517     scmatrix& operator=(const rmatrix_slice& A) {
00518       return spf_mm_assign<scmatrix,rmatrix_slice,complex>(*this,A);
00519     }
00520 
00522     scmatrix& operator=(const cmatrix_slice& A) {
00523       return spf_mm_assign<scmatrix,cmatrix_slice,complex>(*this,A);
00524     }
00525 
00527     scmatrix& operator=(const srmatrix& A) {
00528       m = A.m;
00529       n = A.n;
00530       p = A.p;
00531       ind = A.ind;
00532       x.clear();
00533       x.reserve(A.get_nnz());
00534       for(unsigned int i=0 ; i<A.x.size() ; i++)
00535         x.push_back(complex(A.x[i]));
00536       return *this;
00537     }
00538 
00539     /* scmatrix& operator=(const scmatrix& A) {
00540       p = A.p;
00541       ind = A.ind;
00542       x = A.x;
00543       return *this;
00544     } */
00545 
00547     scmatrix& operator=(const srmatrix_slice&);
00549     scmatrix& operator=(const scmatrix_slice&);
00550 
00552 
00558     const complex operator()(int i, int j) const {
00559 #if(CXSC_INDEX_CHECK)
00560       if(i<lb1 || i>ub1 || j<lb2 || j>ub2)
00561         cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator()(int, int)"));
00562 #endif
00563       complex r(0.0);
00564       for(int k=p[j-lb2] ; k<p[j-lb2+1] && ind[k]<=i-lb1 ; k++) {
00565         if(ind[k] == i-lb1)  r = x[k];
00566       }
00567       return r;
00568     }
00569 
00571 
00579     complex& element(int i, int j) {
00580 #if(CXSC_INDEX_CHECK)
00581       if(i<lb1 || i>ub1 || j<lb2 || j>ub2)
00582         cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::element()(int, int)"));
00583 #endif
00584       int k;
00585       for(k=p[j-lb2] ; k<p[j-lb2+1] && ind[k]<=i-lb1 ; k++) {
00586         if(ind[k] == i-lb1)  return x[k];
00587       }
00588 
00589       //Nicht gefunden, Element muss angelegt werden, da Schreibzugriff moeglich
00590       std::vector<int>::iterator ind_it = ind.begin() + k;
00591       std::vector<complex>::iterator x_it  = x.begin() + k;
00592       ind.insert(ind_it, i-lb1);
00593       x_it = x.insert(x_it, complex(0.0));
00594       for(k=j-lb2+1 ; k<(int)p.size() ; k++)
00595         p[k]++;
00596 
00597       return *x_it;
00598     }
00599 
00601     scmatrix_subv operator[](const cxscmatrix_column&);
00603     scmatrix_subv operator[](const int);
00605     const scmatrix_subv operator[](const cxscmatrix_column&) const;
00607     const scmatrix_subv operator[](const int) const;
00608 
00610     scmatrix_slice operator()(const int, const int , const int, const int);
00612     const scmatrix_slice operator()(const int, const int , const int, const int) const;
00613 
00615     scmatrix operator()(const intvector& pervec, const intvector& q) {
00616       scmatrix A(m,n,get_nnz());
00617       intvector per = perminv(pervec);
00618 
00619       int nnz=0;
00620       for(int k=0 ; k<n ; k++) {
00621         A.p[k] = nnz;
00622 
00623         std::map<int,complex> work;
00624         for(int j=p[q[Lb(q)+k]] ; j<p[q[Lb(q)+k]+1] ; j++) 
00625            work.insert(std::make_pair(per[Lb(per)+ind[j]], x[j]));
00626         
00627         for(std::map<int,complex>::iterator it = work.begin() ; it != work.end() ; it++) {
00628            A.ind.push_back(it->first);
00629            A.x.push_back(it->second);
00630         }
00631 
00632         nnz += work.size();
00633  
00634       }
00635 
00636       A.p[n] = nnz;
00637 
00638       return A;
00639     }
00640 
00642     scmatrix operator()(const intvector& pervec) {
00643       scmatrix A(m,n,get_nnz());
00644       intvector per = perminv(pervec);
00645 
00646       for(int k=0 ; k<n ; k++) {
00647         A.p[k] = p[k];
00648 
00649         std::map<int,complex> work;
00650         for(int j=p[k] ; j<p[k+1] ; j++) 
00651            work.insert(std::make_pair(per[Lb(per)+ind[j]], x[j]));
00652         
00653         for(std::map<int,complex>::iterator it = work.begin() ; it != work.end() ; it++) {
00654            A.ind.push_back(it->first);
00655            A.x.push_back(it->second);
00656         }
00657  
00658       }
00659 
00660       A.p[n] = p[n];
00661 
00662       return A;
00663     }
00664 
00666     scmatrix operator()(const intmatrix& P, const intmatrix& Q) {
00667       intvector p = permvec(P);
00668       intvector q = perminv(permvec(Q));
00669       return (*this)(p,q);
00670     }
00671 
00673     scmatrix operator()(const intmatrix& P) {
00674       intvector p = permvec(P);
00675       return (*this)(p);
00676     }
00677 
00679     real density() const {
00680       return p[n]/((double)m*n);
00681     }
00682 
00684     int get_nnz() const {
00685       return p[n];
00686     }
00687 
00689     scmatrix& operator+=(const rmatrix& B) {
00690       return spf_mm_addassign<scmatrix,rmatrix,cmatrix>(*this,B);
00691     }
00692 
00694     scmatrix& operator+=(const cmatrix& B) {
00695       return spf_mm_addassign<scmatrix,cmatrix,cmatrix>(*this,B);
00696     }
00697 
00699     scmatrix& operator+=(const rmatrix_slice& B) {
00700       return spf_mm_addassign<scmatrix,rmatrix_slice,cmatrix>(*this,B);
00701     }
00702 
00704     scmatrix& operator+=(const cmatrix_slice& B) {
00705       return spf_mm_addassign<scmatrix,cmatrix_slice,cmatrix>(*this,B);
00706     }
00707 
00709     scmatrix& operator+=(const srmatrix& B) {
00710       return spsp_mm_addassign<scmatrix,srmatrix,complex>(*this,B);
00711     }
00712 
00714     scmatrix& operator+=(const scmatrix& B) {
00715       return spsp_mm_addassign<scmatrix,scmatrix,complex>(*this,B);
00716     }
00717 
00719     scmatrix& operator-=(const rmatrix& B) {
00720       return spf_mm_subassign<scmatrix,rmatrix,cmatrix>(*this,B);
00721     }
00722 
00724     scmatrix& operator-=(const cmatrix& B) {
00725       return spf_mm_subassign<scmatrix,cmatrix,cmatrix>(*this,B);
00726     }
00727 
00729     scmatrix& operator-=(const rmatrix_slice& B) {
00730       return spf_mm_subassign<scmatrix,rmatrix_slice,cmatrix>(*this,B);
00731     }
00732 
00734     scmatrix& operator-=(const cmatrix_slice& B) {
00735       return spf_mm_subassign<scmatrix,cmatrix_slice,cmatrix>(*this,B);
00736     }
00737 
00739     scmatrix& operator-=(const srmatrix& B) {
00740       return spsp_mm_subassign<scmatrix,srmatrix,complex>(*this,B);
00741     }
00742 
00744     scmatrix& operator-=(const scmatrix& B) {
00745       return spsp_mm_subassign<scmatrix,scmatrix,complex>(*this,B);
00746     }
00747 
00749     scmatrix& operator*=(const cmatrix& B) {
00750       return spf_mm_multassign<scmatrix,cmatrix,sparse_cdot,cmatrix>(*this,B);
00751     }
00752 
00754     scmatrix& operator*=(const rmatrix& B) {
00755       return spf_mm_multassign<scmatrix,rmatrix,sparse_cdot,cmatrix>(*this,B);
00756     }
00757 
00759     scmatrix& operator*=(const rmatrix_slice& B) {
00760       return spf_mm_multassign<scmatrix,rmatrix_slice,sparse_cdot,cmatrix>(*this,B);
00761     }
00762 
00764     scmatrix& operator*=(const cmatrix_slice& B) {
00765       return spf_mm_multassign<scmatrix,cmatrix_slice,sparse_cdot,cmatrix>(*this,B);
00766     }
00767 
00769     scmatrix& operator*=(const srmatrix& B) {
00770       return spsp_mm_multassign<scmatrix,srmatrix,sparse_cdot,complex>(*this,B);
00771     }
00772 
00774     scmatrix& operator*=(const scmatrix& B) {
00775       return spsp_mm_multassign<scmatrix,scmatrix,sparse_cdot,complex>(*this,B);
00776     }
00777 
00779     scmatrix& operator*=(const real& r) {
00780       return sp_ms_multassign(*this,r);
00781     }
00782 
00784     scmatrix& operator*=(const complex& r) {
00785       return sp_ms_multassign(*this,r);
00786     }
00787 
00789     scmatrix& operator/=(const real& r) {
00790       return sp_ms_divassign(*this,r);
00791     }
00792 
00794     scmatrix& operator/=(const complex& r) {
00795       return sp_ms_divassign(*this,r);
00796     }
00797 
00798     friend void SetLb(scmatrix&, const int, const int);
00799     friend void SetUb(scmatrix&, const int, const int);    
00800     friend int Lb(const scmatrix&, int);
00801     friend int Ub(const scmatrix&, int);
00802     friend int RowLen(const scmatrix&);
00803     friend int ColLen(const scmatrix&);
00804     friend srmatrix Re(const scmatrix&);
00805     friend srmatrix Im(const scmatrix&);
00806     friend scmatrix Inf(const scimatrix&);
00807     friend scmatrix Sup(const scimatrix&);
00808     friend scmatrix mid(const scimatrix&);
00809     friend scmatrix diam(const scimatrix&);
00810     friend srmatrix abs(const scmatrix&);
00811 
00812     friend srmatrix CompMat(const scmatrix&);
00813     friend scmatrix transp(const scmatrix&);
00814     friend scmatrix Id(const scmatrix&);
00815 
00816     friend std::istream& operator>>(std::istream&, scmatrix_slice&);
00817     friend std::istream& operator>>(std::istream&, scmatrix_subv&);
00818 
00819     friend class srmatrix_slice;
00820     friend class srmatrix_subv;
00821     friend class srvector;
00822     friend class scmatrix_slice;
00823     friend class scmatrix_subv;
00824     friend class scvector;
00825     friend class scivector;
00826     friend class scimatrix;
00827     friend class scimatrix_slice;
00828     friend class scimatrix_subv;
00829     friend class cmatrix;
00830     friend class cimatrix;
00831 
00832 
00833 #include "matrix_friend_declarations.inl"
00834 };
00835 
00836 inline cmatrix::cmatrix(const srmatrix& A) {
00837   dat = new complex[A.m*A.n];
00838   lb1 = A.lb1; lb2 = A.lb2; ub1 = A.ub1; ub2 = A.ub2;
00839   xsize = A.n;
00840   ysize = A.m;
00841   *this = 0.0;
00842   for(int j=0 ; j<A.n ; j++) {
00843      for(int k=A.p[j] ; k<A.p[j+1] ; k++) {
00844         dat[A.ind[k]*A.n+j] = A.x[k];
00845      }
00846   }
00847 }
00848 
00849 inline cmatrix::cmatrix(const scmatrix& A) {
00850   dat = new complex[A.m*A.n];
00851   lb1 = A.lb1; lb2 = A.lb2; ub1 = A.ub1; ub2 = A.ub2;
00852   xsize = A.n;
00853   ysize = A.m;
00854   *this = 0.0;
00855   for(int j=0 ; j<A.n ; j++) {
00856      for(int k=A.p[j] ; k<A.p[j+1] ; k++) {
00857         dat[A.ind[k]*A.n+j] = A.x[k];
00858      }
00859   }
00860 }
00861 
00863 inline scmatrix Id(const scmatrix& A) {
00864   scmatrix I(A.m, A.n, (A.m>A.n) ? A.m : A.n);
00865   I.lb1 = A.lb1; I.lb2 = A.lb2;
00866   I.ub1 = A.ub1; I.ub2 = A.ub2;
00867 
00868   if(A.m < A.n) {
00869     for(int i=0 ; i<A.m ; i++) {
00870       I.p[i+1] = I.p[i] + 1;
00871       I.ind.push_back(i);
00872       I.x.push_back(complex(1.0));
00873     }
00874   } else {
00875     for(int i=0 ; i<A.n ; i++) {
00876       I.p[i+1] = I.p[i] + 1;
00877       I.ind.push_back(i);
00878       I.x.push_back(complex(1.0));
00879     }
00880   }
00881 
00882   return I;
00883 }
00884 
00886 inline scmatrix transp(const scmatrix& A) {
00887   scmatrix B(A.n, A.m, A.get_nnz());
00888     
00889   //Nichtnullen pro Zeile bestimmen
00890   std::vector<int> w(A.m,0);
00891   for(unsigned int i=0 ; i<A.ind.size() ; i++) 
00892     w[A.ind[i]]++;
00893 
00894   //Spalten"pointer" setzen
00895   B.p.resize(A.m+1);
00896   B.p[0] = 0;
00897   for(unsigned int i=1 ; i<B.p.size() ; i++)
00898     B.p[i] = w[i-1] + B.p[i-1];
00899 
00900   //w vorbereiten
00901   w.insert(w.begin(), 0); 
00902   for(unsigned int i=1 ; i<w.size() ; i++) {
00903     w[i] += w[i-1];
00904   }
00905 
00906   //neuer zeilenindex und wert wird gesetzt
00907   int q;
00908   B.ind.resize(A.get_nnz());
00909   B.x.resize(A.get_nnz());
00910   for(int j=0 ; j<A.n ; j++) {
00911     for(int k=A.p[j] ; k<A.p[j+1] ; k++) {
00912       q = w[A.ind[k]]++;
00913       B.ind[q] = j;
00914       B.x[q] = A.x[k];
00915     }
00916   }
00917 
00918   return B;
00919 }
00920 
00922 
00926 inline void SetLb(scmatrix& A, const int i, const int j) {
00927   if(i==1) {
00928     A.lb1 = j;
00929     A.ub1 = j + A.m - 1;
00930   } else if(i==2) {
00931     A.lb2 = j;
00932     A.ub2 = j + A.n - 1;
00933   }
00934 }
00935 
00937 
00941 inline void SetUb(scmatrix& A, const int i, const int j) {
00942   if(i==1) {
00943     A.ub1 = j;
00944     A.lb1 = j - A.m + 1;
00945   } else if(i==2) {
00946     A.ub2 = j;
00947     A.lb2 = j - A.n + 1;
00948   }
00949 }
00950 
00951 
00953 
00956 inline int Lb(const scmatrix& A, int i) {
00957   if(i==1) 
00958     return A.lb1;
00959   else if(i==2)
00960     return A.lb2;
00961   else
00962     return 1;
00963 }
00964 
00966 
00969 inline int Ub(const scmatrix& A, int i) {
00970   if(i==1) 
00971     return A.ub1;
00972   else if(i==2)
00973     return A.ub2;
00974   else
00975     return 1;
00976 }
00977 
00979 inline int RowLen(const scmatrix& A) {
00980   return A.n;
00981 }
00982 
00984 inline int ColLen(const scmatrix& A) {
00985   return A.m;
00986 }
00987 
00989 inline void Resize(scmatrix& A) {
00990   sp_m_resize(A);
00991 }
00992 
00994 inline void Resize(scmatrix& A, const int m, const int n) {
00995   sp_m_resize(A,m,n);
00996 }
00997 
00999 inline void Resize(scmatrix& A, const int l1, const int u1, const int l2, const int u2) {
01000   sp_m_resize(A,l1,u1,l2,u2);
01001 }
01002 
01004 inline srmatrix Re(const scmatrix& A) {
01005   srmatrix res(A.m,A.n,A.get_nnz());
01006   res.lb1 = A.lb1;
01007   res.lb2 = A.lb2;
01008   res.ub1 = A.ub1;
01009   res.ub2 = A.ub2;
01010   res.p   = A.p;
01011   res.ind = A.ind;
01012 
01013   for(int i=0 ; i<res.get_nnz() ; i++)
01014     res.x.push_back(Re(A.x[i]));
01015 
01016   res.dropzeros();
01017 
01018   return res; 
01019 }
01020 
01022 inline srmatrix Im(const scmatrix& A) {
01023   srmatrix res(A.m,A.n,A.get_nnz());
01024   res.lb1 = A.lb1;
01025   res.lb2 = A.lb2;
01026   res.ub1 = A.ub1;
01027   res.ub2 = A.ub2;
01028   res.p   = A.p;
01029   res.ind = A.ind;
01030 
01031   for(int i=0 ; i<res.get_nnz() ; i++)
01032     res.x.push_back(Im(A.x[i]));
01033 
01034   res.dropzeros();
01035 
01036   return res; 
01037 }
01038 
01040 inline srmatrix abs(const scmatrix& A) {
01041   srmatrix ret;
01042   ret.ind = A.ind;
01043   ret.p = A.p;
01044   for(unsigned int i=0 ; i<ret.x.size() ; i++) 
01045     ret.x[i] = abs(A.x[i]);
01046   return ret;
01047 }
01048 
01050 inline srmatrix CompMat(const scmatrix& A) {
01051   srmatrix res(A.m,A.n,A.get_nnz());
01052   res.lb1 = A.lb1;
01053   res.lb2 = A.lb2;
01054   res.ub1 = A.ub1;
01055   res.ub2 = A.ub2;
01056   res.p   = A.p;
01057   res.ind = A.ind;
01058   res.p[A.n] = A.p[A.n];
01059 
01060   for(int j=0 ; j<res.n ; j++) {
01061     for(int k=A.p[j] ; k<A.p[j+1] ; k++) {
01062       if(A.ind[k] == j)
01063         res.x.push_back(abs(A.x[k]));
01064       else
01065         res.x.push_back(-abs(A.x[k]));
01066     }
01067   }
01068 
01069   res.dropzeros();
01070 
01071   return res; 
01072 }
01073 
01075 
01081 inline cmatrix operator*(const cmatrix& A, const srmatrix& B) {
01082   return fsp_mm_mult<cmatrix,srmatrix,cmatrix,sparse_cdot>(A,B);
01083 }
01084 
01086 
01092 inline cmatrix operator*(const rmatrix& A, const scmatrix& B) {
01093   return fsp_mm_mult<rmatrix,scmatrix,cmatrix,sparse_cdot>(A,B);
01094 }
01095 
01097 
01103 inline cmatrix operator*(const cmatrix& A, const scmatrix& B) {
01104   return fsp_mm_mult<cmatrix,scmatrix,cmatrix,sparse_cdot>(A,B);
01105 }
01106 
01108 
01114 inline cmatrix operator*(const scmatrix& A, const rmatrix& B) {
01115   return spf_mm_mult<scmatrix,rmatrix,cmatrix,sparse_cdot>(A,B);
01116 }
01117 
01119 
01125 inline cmatrix operator*(const srmatrix& A, const cmatrix& B) {
01126   return spf_mm_mult<srmatrix,cmatrix,cmatrix,sparse_cdot>(A,B);
01127 }
01128 
01130 
01136 inline cmatrix operator*(const scmatrix& A, const cmatrix& B) {
01137   return spf_mm_mult<scmatrix,cmatrix,cmatrix,sparse_cdot>(A,B);
01138 }
01139 
01141 
01147 inline cmatrix operator*(const cmatrix_slice& A, const srmatrix& B) {
01148   return fsp_mm_mult<cmatrix_slice,srmatrix,cmatrix,sparse_cdot>(A,B);
01149 }
01150 
01152 
01158 inline cmatrix operator*(const rmatrix_slice& A, const scmatrix& B) {
01159   return fsp_mm_mult<rmatrix_slice,scmatrix,cmatrix,sparse_cdot>(A,B);
01160 }
01161 
01163 
01169 inline cmatrix operator*(const cmatrix_slice& A, const scmatrix& B) {
01170   return fsp_mm_mult<cmatrix_slice,scmatrix,cmatrix,sparse_cdot>(A,B);
01171 }
01172 
01174 
01180 inline cmatrix operator*(const scmatrix& A, const rmatrix_slice& B) {
01181   return spf_mm_mult<scmatrix,rmatrix_slice,cmatrix,sparse_cdot>(A,B);
01182 }
01183 
01185 
01191 inline cmatrix operator*(const srmatrix& A, const cmatrix_slice& B) {
01192   return spf_mm_mult<srmatrix,cmatrix_slice,cmatrix,sparse_cdot>(A,B);
01193 }
01194 
01196 
01202 inline cmatrix operator*(const scmatrix& A, const cmatrix_slice& B) {
01203   return spf_mm_mult<scmatrix,cmatrix_slice,cmatrix,sparse_cdot>(A,B);
01204 }
01205 
01207 
01213 inline scmatrix operator*(const scmatrix& A, const srmatrix& B) {
01214   return spsp_mm_mult<scmatrix,srmatrix,scmatrix,sparse_cdot,complex>(A,B);
01215 }
01216 
01218 
01224 inline scmatrix operator*(const srmatrix& A, const scmatrix& B) {
01225   return spsp_mm_mult<srmatrix,scmatrix,scmatrix,sparse_cdot,complex>(A,B);
01226 }
01227 
01229 
01235 inline scmatrix operator*(const scmatrix& A, const scmatrix& B) {
01236   return spsp_mm_mult<scmatrix,scmatrix,scmatrix,sparse_cdot,complex>(A,B);
01237 }
01238 
01240 inline scmatrix operator/(const scmatrix& A, const real& r) {
01241   return sp_ms_div<scmatrix,real,scmatrix>(A,r);
01242 }
01243 
01245 inline scmatrix operator/(const scmatrix& A, const complex& r) {
01246   return sp_ms_div<scmatrix,complex,scmatrix>(A,r);
01247 }
01248 
01250 inline scmatrix operator/(const srmatrix& A, const complex& r) {
01251   return sp_ms_div<srmatrix,complex,scmatrix>(A,r);
01252 }
01253 
01255 inline scmatrix operator*(const scmatrix& A, const real& r) {
01256   return sp_ms_mult<scmatrix,real,scmatrix>(A,r);
01257 }
01258 
01260 inline scmatrix operator*(const scmatrix& A, const complex& r) {
01261   return sp_ms_mult<scmatrix,complex,scmatrix>(A,r);
01262 }
01263 
01265 inline scmatrix operator*(const srmatrix& A, const complex& r) {
01266   return sp_ms_mult<srmatrix,complex,scmatrix>(A,r);
01267 }
01268 
01270 inline scmatrix operator*(const real& r, const scmatrix& A) {
01271   return sp_sm_mult<real,scmatrix,scmatrix>(r,A);
01272 }
01273 
01275 inline scmatrix operator*(const complex& r, const scmatrix& A) {
01276   return sp_sm_mult<complex,scmatrix,scmatrix>(r,A);
01277 }
01278 
01280 inline scmatrix operator*(const complex& r, const srmatrix& A) {
01281   return sp_sm_mult<complex,srmatrix,scmatrix>(r,A);
01282 }
01283 
01285 
01291 inline cvector operator*(const scmatrix& A, const rvector& v) {
01292   return spf_mv_mult<scmatrix,rvector,cvector,sparse_cdot>(A,v);
01293 }
01294 
01296 
01302 inline cvector operator*(const srmatrix& A, const cvector& v) {
01303   return spf_mv_mult<srmatrix,cvector,cvector,sparse_cdot>(A,v);
01304 }
01305 
01307 
01313 inline cvector operator*(const scmatrix& A, const cvector& v) {
01314   return spf_mv_mult<scmatrix,cvector,cvector,sparse_cdot>(A,v);
01315 }
01316 
01318 
01324 inline cvector operator*(const scmatrix& A, const rvector_slice& v) {
01325   return spf_mv_mult<scmatrix,rvector_slice,cvector,sparse_cdot>(A,v);
01326 }
01327 
01329 
01335 inline cvector operator*(const srmatrix& A, const cvector_slice& v) {
01336   return spf_mv_mult<srmatrix,cvector_slice,cvector,sparse_cdot>(A,v);
01337 }
01338 
01340 
01346 inline cvector operator*(const scmatrix& A, const cvector_slice& v) {
01347   return spf_mv_mult<scmatrix,cvector_slice,cvector,sparse_cdot>(A,v);
01348 }
01349 
01351 
01357 inline scvector operator*(const scmatrix& A, const srvector& v) {
01358   return spsp_mv_mult<scmatrix,srvector,scvector,sparse_cdot,complex>(A,v);
01359 }
01360 
01362 
01368 inline scvector operator*(const srmatrix& A, const scvector& v) {
01369   return spsp_mv_mult<srmatrix,scvector,scvector,sparse_cdot,complex>(A,v);
01370 }
01371 
01373 
01379 inline scvector operator*(const scmatrix& A, const scvector& v) {
01380   return spsp_mv_mult<scmatrix,scvector,scvector,sparse_cdot,complex>(A,v);
01381 }
01382 
01384 
01390 inline scvector operator*(const scmatrix& A, const srvector_slice& v) {
01391   return spsl_mv_mult<scmatrix,srvector_slice,scvector,sparse_cdot,complex>(A,v);
01392 }
01393 
01395 
01401 inline scvector operator*(const srmatrix& A, const scvector_slice& v) {
01402   return spsl_mv_mult<srmatrix,scvector_slice,scvector,sparse_cdot,complex>(A,v);
01403 }
01404 
01406 
01412 inline scvector operator*(const scmatrix& A, const scvector_slice& v) {
01413   return spsl_mv_mult<scmatrix,scvector_slice,scvector,sparse_cdot,complex>(A,v);
01414 }
01415 
01417 
01423 inline cvector operator*(const cmatrix& A, const srvector& v) {
01424   return fsp_mv_mult<cmatrix,srvector,cvector,sparse_cdot>(A,v);
01425 }
01426 
01428 
01434 inline cvector operator*(const rmatrix& A, const scvector& v) {
01435   return fsp_mv_mult<rmatrix,scvector,cvector,sparse_cdot>(A,v);
01436 }
01437 
01439 
01445 inline cvector operator*(const cmatrix& A, const scvector& v) {
01446   return fsp_mv_mult<cmatrix,scvector,cvector,sparse_cdot>(A,v);
01447 }
01448 
01450 
01456 inline cvector operator*(const cmatrix_slice& A, const srvector& v) {
01457   return fsp_mv_mult<cmatrix_slice,srvector,cvector,sparse_cdot>(A,v);
01458 }
01459 
01461 
01467 inline cvector operator*(const rmatrix_slice& A, const scvector& v) {
01468   return fsp_mv_mult<rmatrix_slice,scvector,cvector,sparse_cdot>(A,v);
01469 }
01470 
01472 
01478 inline cvector operator*(const cmatrix_slice& A, const scvector& v) {
01479   return fsp_mv_mult<cmatrix_slice,scvector,cvector,sparse_cdot>(A,v);
01480 }
01481 
01483 
01489 inline cvector operator*(const cmatrix& A, const srvector_slice& v) {
01490   return fsl_mv_mult<cmatrix,srvector_slice,cvector,sparse_cdot>(A,v);
01491 }
01492 
01494 
01500 inline cvector operator*(const rmatrix& A, const scvector_slice& v) {
01501   return fsl_mv_mult<rmatrix,scvector_slice,cvector,sparse_cdot>(A,v);
01502 }
01503 
01505 
01511 inline cvector operator*(const cmatrix& A, const scvector_slice& v) {
01512   return fsl_mv_mult<cmatrix,scvector_slice,cvector,sparse_cdot>(A,v);
01513 }
01514 
01516 
01522 inline cvector operator*(const cmatrix_slice& A, const srvector_slice& v) {
01523   return fsl_mv_mult<cmatrix_slice,srvector_slice,cvector,sparse_cdot>(A,v);
01524 }
01525 
01527 
01533 inline cvector operator*(const rmatrix_slice& A, const scvector_slice& v) {
01534   return fsl_mv_mult<rmatrix_slice,scvector_slice,cvector,sparse_cdot>(A,v);
01535 }
01536 
01538 
01544 inline cvector operator*(const cmatrix_slice& A, const scvector_slice& v) {
01545   return fsl_mv_mult<cmatrix_slice,scvector_slice,cvector,sparse_cdot>(A,v);
01546 }
01547 
01549 inline cmatrix operator+(const cmatrix& A, const srmatrix& B) {
01550   return fsp_mm_add<cmatrix,srmatrix,cmatrix>(A,B);
01551 }
01552 
01554 inline cmatrix operator+(const rmatrix& A, const scmatrix& B) {
01555   return fsp_mm_add<rmatrix,scmatrix,cmatrix>(A,B);
01556 }
01557 
01559 inline cmatrix operator+(const cmatrix& A, const scmatrix& B) {
01560   return fsp_mm_add<cmatrix,scmatrix,cmatrix>(A,B);
01561 }
01562 
01564 inline cmatrix operator+(const scmatrix& A, const rmatrix& B) {
01565   return spf_mm_add<scmatrix,rmatrix,cmatrix>(A,B);
01566 }
01567 
01569 inline cmatrix operator+(const srmatrix& A, const cmatrix& B) {
01570   return spf_mm_add<srmatrix,cmatrix,cmatrix>(A,B);
01571 }
01572 
01574 inline cmatrix operator+(const scmatrix& A, const cmatrix& B) {
01575   return spf_mm_add<scmatrix,cmatrix,cmatrix>(A,B);
01576 }
01577 
01579 inline cmatrix operator+(const cmatrix_slice& A, const srmatrix& B) {
01580   return fsp_mm_add<cmatrix_slice,srmatrix,cmatrix>(A,B);
01581 }
01582 
01584 inline cmatrix operator+(const rmatrix_slice& A, const scmatrix& B) {
01585   return fsp_mm_add<rmatrix_slice,scmatrix,cmatrix>(A,B);
01586 }
01587 
01589 inline cmatrix operator+(const cmatrix_slice& A, const scmatrix& B) {
01590   return fsp_mm_add<cmatrix_slice,scmatrix,cmatrix>(A,B);
01591 }
01592 
01594 inline cmatrix operator+(const scmatrix& A, const rmatrix_slice& B) {
01595   return spf_mm_add<scmatrix,rmatrix_slice,cmatrix>(A,B);
01596 }
01597 
01599 inline cmatrix operator+(const srmatrix& A, const cmatrix_slice& B) {
01600   return spf_mm_add<srmatrix,cmatrix_slice,cmatrix>(A,B);
01601 }
01602 
01604 inline cmatrix operator+(const scmatrix& A, const cmatrix_slice& B) {
01605   return spf_mm_add<scmatrix,cmatrix_slice,cmatrix>(A,B);
01606 }
01607 
01609 inline scmatrix operator+(const scmatrix& A, const srmatrix& B) {
01610   return spsp_mm_add<scmatrix,srmatrix,scmatrix,complex>(A,B);
01611 }
01612 
01614 inline scmatrix operator+(const srmatrix& A, const scmatrix& B) {
01615   return spsp_mm_add<srmatrix,scmatrix,scmatrix,complex>(A,B);
01616 }
01617 
01619 inline scmatrix operator+(const scmatrix& A, const scmatrix& B) {
01620   return spsp_mm_add<scmatrix,scmatrix,scmatrix,complex>(A,B);
01621 }
01622 
01624 inline cmatrix operator-(const cmatrix& A, const srmatrix& B) {
01625   return fsp_mm_sub<cmatrix,srmatrix,cmatrix>(A,B);
01626 }
01627 
01629 inline cmatrix operator-(const rmatrix& A, const scmatrix& B) {
01630   return fsp_mm_sub<rmatrix,scmatrix,cmatrix>(A,B);
01631 }
01632 
01634 inline cmatrix operator-(const cmatrix& A, const scmatrix& B) {
01635   return fsp_mm_sub<cmatrix,scmatrix,cmatrix>(A,B);
01636 }
01637 
01639 inline cmatrix operator-(const scmatrix& A, const rmatrix& B) {
01640   return spf_mm_sub<scmatrix,rmatrix,cmatrix>(A,B);
01641 }
01642 
01644 inline cmatrix operator-(const srmatrix& A, const cmatrix& B) {
01645   return spf_mm_sub<srmatrix,cmatrix,cmatrix>(A,B);
01646 }
01647 
01649 inline cmatrix operator-(const scmatrix& A, const cmatrix& B) {
01650   return spf_mm_sub<scmatrix,cmatrix,cmatrix>(A,B);
01651 }
01652 
01654 inline cmatrix operator-(const cmatrix_slice& A, const srmatrix& B) {
01655   return fsp_mm_sub<cmatrix_slice,srmatrix,cmatrix>(A,B);
01656 }
01657 
01659 inline cmatrix operator-(const rmatrix_slice& A, const scmatrix& B) {
01660   return fsp_mm_sub<rmatrix_slice,scmatrix,cmatrix>(A,B);
01661 }
01662 
01664 inline cmatrix operator-(const cmatrix_slice& A, const scmatrix& B) {
01665   return fsp_mm_sub<cmatrix_slice,scmatrix,cmatrix>(A,B);
01666 }
01667 
01669 inline cmatrix operator-(const scmatrix& A, const rmatrix_slice& B) {
01670   return spf_mm_sub<scmatrix,rmatrix_slice,cmatrix>(A,B);
01671 }
01672 
01674 inline cmatrix operator-(const srmatrix& A, const cmatrix_slice& B) {
01675   return spf_mm_sub<srmatrix,cmatrix_slice,cmatrix>(A,B);
01676 }
01677 
01679 inline cmatrix operator-(const scmatrix& A, const cmatrix_slice& B) {
01680   return spf_mm_sub<scmatrix,cmatrix_slice,cmatrix>(A,B);
01681 }
01682 
01684 inline scmatrix operator-(const scmatrix& A, const srmatrix& B) {
01685   return spsp_mm_sub<scmatrix,srmatrix,scmatrix,complex>(A,B);
01686 }
01687 
01689 inline scmatrix operator-(const srmatrix& A, const scmatrix& B) {
01690   return spsp_mm_sub<srmatrix,scmatrix,scmatrix,complex>(A,B);
01691 }
01692 
01694 inline scmatrix operator-(const scmatrix& A, const scmatrix& B) {
01695   return spsp_mm_sub<scmatrix,scmatrix,scmatrix,complex>(A,B);
01696 }
01697 
01699 inline scmatrix operator-(const scmatrix& M) {
01700   return sp_m_negative<scmatrix,scmatrix>(M);
01701 }
01702 
01704 inline scmatrix& operator+(scmatrix& A) {
01705   return A;
01706 }
01707 
01708 inline cmatrix& cmatrix::operator=(const srmatrix& B) {
01709   *this = rmatrix(B);
01710   return *this;
01711 }
01712 
01713 inline cmatrix_slice& cmatrix_slice::operator=(const srmatrix& B) {
01714   *this = rmatrix(B);
01715   return *this;
01716 }
01717 
01718 inline cmatrix& cmatrix::operator=(const scmatrix& B) {
01719   *this = cmatrix(B);
01720   return *this;
01721 }
01722 
01723 inline cmatrix_slice& cmatrix_slice::operator=(const scmatrix& B) {
01724   *this = cmatrix(B);
01725   return *this;
01726 }
01727 
01728 inline cmatrix& cmatrix::operator+=(const srmatrix& B) {
01729   return fsp_mm_addassign(*this,B);
01730 }
01731 
01732 inline cmatrix& cmatrix::operator+=(const scmatrix& B) {
01733   return fsp_mm_addassign(*this,B);
01734 }
01735 
01736 inline cmatrix_slice& cmatrix_slice::operator+=(const srmatrix& B) {
01737   return fsp_mm_addassign(*this,B);
01738 }
01739 
01740 inline cmatrix_slice& cmatrix_slice::operator+=(const scmatrix& B) {
01741   return fsp_mm_addassign(*this,B);
01742 }
01743 
01744 inline cmatrix& cmatrix::operator-=(const srmatrix& B) {
01745   return fsp_mm_subassign(*this,B);
01746 }
01747 
01748 inline cmatrix& cmatrix::operator-=(const scmatrix& B) {
01749   return fsp_mm_subassign(*this,B);
01750 }
01751 
01752 inline cmatrix_slice& cmatrix_slice::operator-=(const srmatrix& B) {
01753   return fsp_mm_subassign(*this,B);
01754 }
01755 
01756 inline cmatrix_slice& cmatrix_slice::operator-=(const scmatrix& B) {
01757   return fsp_mm_subassign(*this,B);
01758 }
01759 
01760 inline cmatrix& cmatrix::operator*=(const srmatrix& B) {
01761   return fsp_mm_multassign<cmatrix,srmatrix,sparse_cdot,cmatrix>(*this,B);
01762 }
01763 
01764 inline cmatrix& cmatrix::operator*=(const scmatrix& B) {
01765   return fsp_mm_multassign<cmatrix,scmatrix,sparse_cdot,cmatrix>(*this,B);
01766 }
01767 
01768 inline cmatrix_slice& cmatrix_slice::operator*=(const srmatrix& B) {
01769   return fsp_mm_multassign<cmatrix_slice,srmatrix,sparse_cdot,cmatrix>(*this,B);
01770 }
01771 
01772 inline cmatrix_slice& cmatrix_slice::operator*=(const scmatrix& B) {
01773   return fsp_mm_multassign<cmatrix_slice,scmatrix,sparse_cdot,cmatrix>(*this,B);
01774 }
01775 
01777 inline bool operator==(const scmatrix& A, const srmatrix& B) {
01778   return spsp_mm_comp(A,B);
01779 }
01780 
01782 inline bool operator==(const srmatrix& A, const scmatrix& B) {
01783   return spsp_mm_comp(A,B);
01784 }
01785 
01787 inline bool operator==(const scmatrix& A, const scmatrix& B) {
01788   return spsp_mm_comp(A,B);
01789 }
01790 
01792 inline bool operator==(const scmatrix& A, const rmatrix& B) {
01793   return spf_mm_comp(A,B);
01794 }
01795 
01797 inline bool operator==(const srmatrix& A, const cmatrix& B) {
01798   return spf_mm_comp(A,B);
01799 }
01800 
01802 inline bool operator==(const scmatrix& A, const cmatrix& B) {
01803   return spf_mm_comp(A,B);
01804 }
01805 
01807 inline bool operator==(const cmatrix& A, const srmatrix& B) {
01808   return fsp_mm_comp(A,B);
01809 }
01810 
01812 inline bool operator==(const rmatrix& A, const scmatrix& B) {
01813   return fsp_mm_comp(A,B);
01814 }
01815 
01817 inline bool operator==(const cmatrix& A, const scmatrix& B) {
01818   return fsp_mm_comp(A,B);
01819 }
01820 
01822 inline bool operator==(const cmatrix_slice& A, const srmatrix& B) {
01823   return fsp_mm_comp(A,B);
01824 }
01825 
01827 inline bool operator==(const rmatrix_slice& A, const scmatrix& B) {
01828   return fsp_mm_comp(A,B);
01829 }
01830 
01832 inline bool operator==(const cmatrix_slice& A, const scmatrix& B) {
01833   return fsp_mm_comp(A,B);
01834 }
01835 
01837 inline bool operator==(const scmatrix& A, const rmatrix_slice& B) {
01838   return spf_mm_comp(A,B);
01839 }
01840 
01842 inline bool operator==(const srmatrix& A, const cmatrix_slice& B) {
01843   return spf_mm_comp(A,B);
01844 }
01845 
01847 inline bool operator==(const scmatrix& A, const cmatrix_slice& B) {
01848   return spf_mm_comp(A,B);
01849 }
01850 
01852 inline bool operator!=(const scmatrix& A, const srmatrix& B) {
01853   return !spsp_mm_comp(A,B);
01854 }
01855 
01857 inline bool operator!=(const srmatrix& A, const scmatrix& B) {
01858   return !spsp_mm_comp(A,B);
01859 }
01860 
01862 inline bool operator!=(const scmatrix& A, const scmatrix& B) {
01863   return !spsp_mm_comp(A,B);
01864 }
01865 
01867 inline bool operator!=(const scmatrix& A, const rmatrix& B) {
01868   return !spf_mm_comp(A,B);
01869 }
01870 
01872 inline bool operator!=(const srmatrix& A, const cmatrix& B) {
01873   return !spf_mm_comp(A,B);
01874 }
01875 
01877 inline bool operator!=(const scmatrix& A, const cmatrix& B) {
01878   return !spf_mm_comp(A,B);
01879 }
01880 
01882 inline bool operator!=(const cmatrix& A, const srmatrix& B) {
01883   return !fsp_mm_comp(A,B);
01884 }
01885 
01887 inline bool operator!=(const rmatrix& A, const scmatrix& B) {
01888   return !fsp_mm_comp(A,B);
01889 }
01890 
01892 inline bool operator!=(const cmatrix& A, const scmatrix& B) {
01893   return !fsp_mm_comp(A,B);
01894 }
01895 
01897 inline bool operator!=(const cmatrix_slice& A, const srmatrix& B) {
01898   return !fsp_mm_comp(A,B);
01899 }
01900 
01902 inline bool operator!=(const rmatrix_slice& A, const scmatrix& B) {
01903   return !fsp_mm_comp(A,B);
01904 }
01905 
01907 inline bool operator!=(const cmatrix_slice& A, const scmatrix& B) {
01908   return !fsp_mm_comp(A,B);
01909 }
01910 
01912 inline bool operator!=(const scmatrix& A, const rmatrix_slice& B) {
01913   return !spf_mm_comp(A,B);
01914 }
01915 
01917 inline bool operator!=(const srmatrix& A, const cmatrix_slice& B) {
01918   return !spf_mm_comp(A,B);
01919 }
01920 
01922 inline bool operator!=(const scmatrix& A, const cmatrix_slice& B) {
01923   return !spf_mm_comp(A,B);
01924 }
01925 
01927 inline bool operator!(const scmatrix& A) {
01928   return sp_m_not(A);
01929 }
01930 
01932 
01937 inline std::ostream& operator<<(std::ostream& os, const scmatrix& A) {
01938   return sp_m_output<scmatrix,complex>(os,A);
01939 }
01940 
01942 
01947 inline std::istream& operator>>(std::istream& is, scmatrix& A) {
01948   return sp_m_input<scmatrix,complex>(is,A);
01949 }
01950 
01952 
01956 class scmatrix_slice {
01957   public:
01958     scmatrix  A;
01959     scmatrix* M; //Originalmatrix
01960 
01961   private:
01962     scmatrix_slice(scmatrix& Mat, int sl1l, int sl1u, int sl2l, int sl2u) {    
01963         A.lb1 = sl1l;
01964         A.lb2 = sl2l;
01965         A.ub1 = sl1u;
01966         A.ub2 = sl2u;
01967         A.m   = sl1u-sl1l+1;
01968         A.n   = sl2u-sl2l+1;
01969  
01970         //Kopieren der Werte aus A
01971         A.p = std::vector<int>(A.n+1, 0);
01972         A.ind.reserve(A.m + A.n);
01973         A.x.reserve(A.m + A.n);
01974 
01975         for(int i=0 ; i<A.n ; i++) {
01976            A.p[i+1] = A.p[i];
01977            for(int j=Mat.p[sl2l-Mat.lb2+i] ; j<Mat.p[sl2l-Mat.lb2+i+1] ; j++) {
01978               if(Mat.ind[j] >= sl1l-Mat.lb1  &&  Mat.ind[j] <= sl1u-Mat.lb1) {
01979                 A.ind.push_back(Mat.ind[j]-(sl1l-Mat.lb1));
01980                 A.x.push_back(Mat.x[j]);
01981                 A.p[i+1]++;
01982              }
01983            }
01984         }
01985 
01986         //Zeiger auf A fuer Datenmanipulationen
01987         M = &Mat;
01988     }
01989 
01990     scmatrix_slice(const scmatrix& Mat, int sl1l, int sl1u, int sl2l, int sl2u) {    
01991         A.lb1 = sl1l;
01992         A.lb2 = sl2l;
01993         A.ub1 = sl1u;
01994         A.ub2 = sl2u;
01995         A.m   = sl1u-sl1l+1;
01996         A.n   = sl2u-sl2l+1;
01997  
01998         //Kopieren der Werte aus A
01999         A.p = std::vector<int>(A.n+1, 0);
02000         A.ind.reserve(A.m + A.n);
02001         A.x.reserve(A.m + A.n);
02002 
02003         for(int i=0 ; i<A.n ; i++) {
02004            A.p[i+1] = A.p[i];
02005            for(int j=Mat.p[sl2l-Mat.lb2+i] ; j<Mat.p[sl2l-Mat.lb2+i+1] ; j++) {
02006               if(Mat.ind[j] >= sl1l-Mat.lb1  &&  Mat.ind[j] <= sl1u-Mat.lb1) {
02007                 A.ind.push_back(Mat.ind[j]-(sl1l-Mat.lb1));
02008                 A.x.push_back(Mat.x[j]);
02009                 A.p[i+1]++;
02010              }
02011            }
02012         }
02013 
02014         //Zeiger auf A fuer Datenmanipulationen
02015         M = const_cast<scmatrix*>(&Mat);
02016     }
02017 
02018   public:
02020     scmatrix_slice& operator=(const real& C) {
02021       return sl_ms_assign<scmatrix_slice, real, std::vector<complex>::iterator, complex>(*this,C);
02022     }
02023 
02025     scmatrix_slice& operator=(const complex& C) {
02026       return sl_ms_assign<scmatrix_slice, complex, std::vector<complex>::iterator, complex>(*this,C);
02027     }
02028 
02030     scmatrix_slice& operator=(const srmatrix& C) {
02031       return slsp_mm_assign<scmatrix_slice, srmatrix, std::vector<complex>::iterator>(*this,C);
02032     }
02033 
02035     scmatrix_slice& operator=(const scmatrix& C) {
02036       return slsp_mm_assign<scmatrix_slice, scmatrix, std::vector<complex>::iterator>(*this,C);
02037     }
02038 
02040     scmatrix_slice& operator=(const rmatrix& C) {
02041       return slf_mm_assign<scmatrix_slice, rmatrix, std::vector<complex>::iterator, complex>(*this,C);
02042     }
02043 
02045     scmatrix_slice& operator=(const cmatrix& C) {
02046       return slf_mm_assign<scmatrix_slice, cmatrix, std::vector<complex>::iterator, complex>(*this,C);
02047     }
02048 
02050     scmatrix_slice& operator=(const rmatrix_slice& C) {
02051       return slf_mm_assign<scmatrix_slice, rmatrix_slice, std::vector<complex>::iterator, complex>(*this,C);
02052     }
02053 
02055     scmatrix_slice& operator=(const cmatrix_slice& C) {
02056       return slf_mm_assign<scmatrix_slice, cmatrix_slice, std::vector<complex>::iterator, complex>(*this,C);
02057     }
02058 
02060     scmatrix_slice& operator=(const srmatrix_slice& C) {
02061       *this = C.A;
02062       return *this;
02063     }
02064 
02066     scmatrix_slice& operator=(const scmatrix_slice& C) {
02067       *this = C.A;
02068       return *this;
02069     }
02070 
02072     scmatrix_slice& operator*=(const srmatrix_slice& M) {
02073       *this = A*M.A;
02074       return *this;
02075     }
02076 
02078     scmatrix_slice& operator*=(const scmatrix_slice& M) {
02079       *this = A*M.A;
02080       return *this;
02081     }
02082 
02084     scmatrix_slice& operator*=(const srmatrix& M) {
02085       *this = A*M;
02086       return *this;
02087     }
02088 
02090     scmatrix_slice& operator*=(const scmatrix& M) {
02091       *this = A*M;
02092       return *this;
02093     }
02094 
02096     scmatrix_slice& operator*=(const rmatrix& M) {
02097       *this = A*M;
02098       return *this;
02099     }
02100 
02102     scmatrix_slice& operator*=(const cmatrix& M) {
02103       *this = A*M;
02104       return *this;
02105     }
02106 
02108     scmatrix_slice& operator*=(const rmatrix_slice& M) {
02109       *this = A*M;
02110       return *this;
02111     }
02112 
02114     scmatrix_slice& operator*=(const cmatrix_slice& M) {
02115       *this = A*M;
02116       return *this;
02117     }
02118 
02120     scmatrix_slice& operator*=(const real& r) {
02121       *this = A*r;
02122       return *this;
02123     }
02124 
02126     scmatrix_slice& operator*=(const complex& r) {
02127       *this = A*r;
02128       return *this;
02129     }
02130 
02132     scmatrix_slice& operator/=(const real& r) {
02133       *this = A/r;
02134       return *this;
02135     }
02136 
02138     scmatrix_slice& operator/=(const complex& r) {
02139       *this = A/r;
02140       return *this;
02141     }
02142 
02144     scmatrix_slice& operator+=(const srmatrix_slice& M) {
02145       *this = A+M.A;
02146       return *this;
02147     } 
02148 
02150     scmatrix_slice& operator+=(const scmatrix_slice& M) {
02151       *this = A+M.A;
02152       return *this;
02153     } 
02154 
02156     scmatrix_slice& operator+=(const srmatrix& M) {
02157       *this = A+M;
02158       return *this;
02159     } 
02160 
02162     scmatrix_slice& operator+=(const scmatrix& M) {
02163       *this = A+M;
02164       return *this;
02165     } 
02166 
02168     scmatrix_slice& operator+=(const rmatrix& M) {
02169       *this = A+M;
02170       return *this;
02171     } 
02172 
02174     scmatrix_slice& operator+=(const cmatrix& M) {
02175       *this = A+M;
02176       return *this;
02177     } 
02178 
02180     scmatrix_slice& operator+=(const rmatrix_slice& M) {
02181       *this = A+M;
02182       return *this;
02183     } 
02184 
02186     scmatrix_slice& operator+=(const cmatrix_slice& M) {
02187       *this = A+M;
02188       return *this;
02189     } 
02190 
02192     scmatrix_slice& operator-=(const srmatrix_slice& M) {
02193       *this = A-M.A;
02194       return *this;
02195     } 
02196 
02198     scmatrix_slice& operator-=(const scmatrix_slice& M) {
02199       *this = A-M.A;
02200       return *this;
02201     } 
02202 
02204     scmatrix_slice& operator-=(const srmatrix& M) {
02205       *this = A-M;
02206       return *this;
02207     } 
02208 
02210     scmatrix_slice& operator-=(const scmatrix& M) {
02211       *this = A-M;
02212       return *this;
02213     } 
02214 
02216     scmatrix_slice& operator-=(const rmatrix& M) {
02217       *this = A-M;
02218       return *this;
02219     } 
02220 
02222     scmatrix_slice& operator-=(const cmatrix& M) {
02223       *this = A-M;
02224       return *this;
02225     } 
02226 
02228     scmatrix_slice& operator-=(const rmatrix_slice& M) {
02229       *this = A-M;
02230       return *this;
02231     }
02232 
02234     scmatrix_slice& operator-=(const cmatrix_slice& M) {
02235       *this = A-M;
02236       return *this;
02237     }
02238 
02240 
02244     const complex operator()(const int i, const int j) const {
02245 #if(CXSC_INDEX_CHECK)
02246       if(i<A.lb1 || i>A.ub1 || j<A.lb2 || j>A.ub2)
02247         cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_slice::operator()(int, int)"));
02248 #endif
02249       complex r = A(i,j);
02250       return r;
02251     }
02252 
02254 
02258     complex& element(const int i, const int j) {
02259 #if(CXSC_INDEX_CHECK)
02260       if(i<A.lb1 || i>A.ub1 || j<A.lb2 || j>A.ub2)
02261         cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_slice::element(int, int)"));
02262 #endif
02263       return M->element(i,j);
02264     }
02265 
02267     scmatrix_subv operator[](const int);
02269     scmatrix_subv operator[](const cxscmatrix_column&);
02271     const scmatrix_subv operator[](const int) const;
02273     const scmatrix_subv operator[](const cxscmatrix_column&) const;
02274 
02275     friend std::ostream& operator<<(std::ostream&, const scmatrix_slice&);
02276     friend std::istream& operator>>(std::istream&, const scmatrix_subv&);
02277 
02278     friend int Lb(const scmatrix_slice&, const int);
02279     friend int Ub(const scmatrix_slice&, const int);
02280     friend srmatrix Re(const scmatrix_slice&);
02281     friend srmatrix Im(const scmatrix_slice&);
02282     friend int RowLen(const scmatrix_slice&);
02283     friend int ColLen(const scmatrix_slice&);
02284 
02285     friend class srmatrix;
02286     friend class srmatrix_subv;
02287     friend class srvector;
02288     friend class scmatrix;
02289     friend class scmatrix_subv;
02290     friend class scvector;
02291     friend class scimatrix;
02292     friend class scimatrix_subv;
02293     friend class scimatrix_slice;
02294     friend class scivector;
02295     friend class cmatrix;
02296     friend class cimatrix;
02297 
02298 #include "matrix_friend_declarations.inl"    
02299 };
02300 
02301 inline cmatrix::cmatrix(const srmatrix_slice& A) {
02302   dat = new complex[A.A.m*A.A.n];
02303   lb1 = A.A.lb1; lb2 = A.A.lb2; ub1 = A.A.ub1; ub2 = A.A.ub2;
02304   xsize = A.A.n;
02305   ysize = A.A.m;
02306   *this = 0.0;
02307   for(int j=0 ; j<A.A.n ; j++) {
02308      for(int k=A.A.p[j] ; k<A.A.p[j+1] ; k++) {
02309         dat[A.A.ind[k]*A.A.n+j] = A.A.x[k];
02310      }
02311   }
02312 }
02313 
02314 inline cmatrix::cmatrix(const scmatrix_slice& A) {
02315   dat = new complex[A.A.m*A.A.n];
02316   lb1 = A.A.lb1; lb2 = A.A.lb2; ub1 = A.A.ub1; ub2 = A.A.ub2;
02317   xsize = A.A.n;
02318   ysize = A.A.m;
02319   *this = 0.0;
02320   for(int j=0 ; j<A.A.n ; j++) {
02321      for(int k=A.A.p[j] ; k<A.A.p[j+1] ; k++) {
02322         dat[A.A.ind[k]*A.A.n+j] = A.A.x[k];
02323      }
02324   }
02325 }
02326 
02328 inline int RowLen(const scmatrix_slice& S) {
02329   return RowLen(S.A);
02330 }
02331 
02333 inline int ColLen(const scmatrix_slice& S) {
02334   return ColLen(S.A);
02335 }
02336 
02337 inline scmatrix_slice scmatrix::operator()(const int i, const int j, const int k, const int l) {
02338 #if(CXSC_INDEX_CHECK)
02339   if(i<lb1 || j>ub1 || k<lb2 || l>ub2)
02340     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator()(int, int, int, int)"));
02341 #endif
02342   return scmatrix_slice(*this, i, j, k, l);
02343 }
02344 
02345 inline const scmatrix_slice scmatrix::operator()(const int i, const int j, const int k, const int l) const {
02346 #if(CXSC_INDEX_CHECK)
02347   if(i<lb1 || j>ub1 || k<lb2 || l>ub2)
02348     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator()(int, int, int, int) const"));
02349 #endif
02350   return scmatrix_slice(*this, i, j, k, l);
02351 }
02352 
02353 inline scmatrix& scmatrix::operator=(const srmatrix_slice& S) {
02354   *this = S.A;
02355   return *this;
02356 }
02357 
02358 inline scmatrix& scmatrix::operator=(const scmatrix_slice& S) {
02359   *this = S.A;
02360   return *this;
02361 }
02362 
02364 inline int Lb(const scmatrix_slice& S, const int i) {
02365   return Lb(S.A, i);
02366 }
02367 
02369 inline int Ub(const scmatrix_slice& S, const int i) {
02370   return Ub(S.A, i);
02371 }
02372 
02374 inline srmatrix Re(const scmatrix_slice& S) {
02375   return Re(S.A);
02376 }
02377 
02379 inline srmatrix Im(const scmatrix_slice& S) {
02380   return Im(S.A);
02381 }
02382 
02383 inline scmatrix::scmatrix(const srmatrix_slice& S) {
02384   m = S.A.m;
02385   n = S.A.n;
02386   lb1 = S.A.lb1;
02387   ub1 = S.A.ub1;
02388   lb2 = S.A.lb2;
02389   ub2 = S.A.ub2;
02390   *this = S.A;
02391 }
02392 
02393 inline scmatrix::scmatrix(const scmatrix_slice& S) {
02394   m = S.A.m;
02395   n = S.A.n;
02396   lb1 = S.A.lb1;
02397   ub1 = S.A.ub1;
02398   lb2 = S.A.lb2;
02399   ub2 = S.A.ub2;
02400   *this = S.A;
02401 }
02402 
02404 inline scmatrix operator-(const scmatrix_slice& M) {
02405   return sp_m_negative<scmatrix,scmatrix>(M.A);
02406 }
02407 
02409 inline scmatrix operator+(const scmatrix_slice& M) {
02410   return M.A;
02411 }
02412 
02414 
02420 inline scmatrix operator*(const scmatrix_slice& M1, const srmatrix_slice& M2) {
02421   return spsp_mm_mult<scmatrix,srmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2.A);
02422 }
02423 
02425 
02431 inline scmatrix operator*(const srmatrix_slice& M1, const scmatrix_slice& M2) {
02432   return spsp_mm_mult<srmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2.A);
02433 }
02434 
02436 
02442 inline scmatrix operator*(const scmatrix_slice& M1, const scmatrix_slice& M2) {
02443   return spsp_mm_mult<scmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2.A);
02444 }
02445 
02447 
02453 inline scmatrix operator*(const scmatrix_slice& M1, const srmatrix& M2) {
02454   return spsp_mm_mult<scmatrix,srmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2);
02455 }
02456 
02458 
02464 inline scmatrix operator*(const srmatrix_slice& M1, const scmatrix& M2) {
02465   return spsp_mm_mult<srmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2);
02466 }
02467 
02469 
02475 inline scmatrix operator*(const scmatrix_slice& M1, const scmatrix& M2) {
02476   return spsp_mm_mult<scmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1.A,M2);
02477 }
02478 
02480 
02486 inline scmatrix operator*(const scmatrix& M1, const srmatrix_slice& M2) {
02487   return spsp_mm_mult<scmatrix,srmatrix,scmatrix,sparse_cdot,complex>(M1,M2.A);
02488 }
02489 
02491 
02497 inline scmatrix operator*(const srmatrix& M1, const scmatrix_slice& M2) {
02498   return spsp_mm_mult<srmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1,M2.A);
02499 }
02500 
02502 
02508 inline scmatrix operator*(const scmatrix& M1, const scmatrix_slice& M2) {
02509   return spsp_mm_mult<scmatrix,scmatrix,scmatrix,sparse_cdot,complex>(M1,M2.A);
02510 }
02511 
02513 
02519 inline cmatrix operator*(const scmatrix_slice& M1, const rmatrix& M2) {
02520   return spf_mm_mult<scmatrix,rmatrix,cmatrix,sparse_cdot>(M1.A,M2);
02521 }
02522 
02524 
02530 inline cmatrix operator*(const srmatrix_slice& M1, const cmatrix& M2) {
02531   return spf_mm_mult<srmatrix,cmatrix,cmatrix,sparse_cdot>(M1.A,M2);
02532 }
02533 
02535 
02541 inline cmatrix operator*(const scmatrix_slice& M1, const cmatrix& M2) {
02542   return spf_mm_mult<scmatrix,cmatrix,cmatrix,sparse_cdot>(M1.A,M2);
02543 }
02544 
02546 
02552 inline cmatrix operator*(const cmatrix& M1, const srmatrix_slice& M2) {
02553   return fsp_mm_mult<cmatrix,srmatrix,cmatrix,sparse_cdot>(M1,M2.A);
02554 }
02555 
02557 
02563 inline cmatrix operator*(const rmatrix& M1, const scmatrix_slice& M2) {
02564   return fsp_mm_mult<rmatrix,scmatrix,cmatrix,sparse_cdot>(M1,M2.A);
02565 }
02566 
02568 
02574 inline cmatrix operator*(const cmatrix& M1, const scmatrix_slice& M2) {
02575   return fsp_mm_mult<cmatrix,scmatrix,cmatrix,sparse_cdot>(M1,M2.A);
02576 }
02577 
02579 
02585 inline cmatrix operator*(const scmatrix_slice& M1, const rmatrix_slice& M2) {
02586   return spf_mm_mult<scmatrix,rmatrix_slice,cmatrix,sparse_cdot>(M1.A,M2);
02587 }
02588 
02590 
02596 inline cmatrix operator*(const srmatrix_slice& M1, const cmatrix_slice& M2) {
02597   return spf_mm_mult<srmatrix,cmatrix_slice,cmatrix,sparse_cdot>(M1.A,M2);
02598 }
02599 
02601 
02607 inline cmatrix operator*(const scmatrix_slice& M1, const cmatrix_slice& M2) {
02608   return spf_mm_mult<scmatrix,cmatrix_slice,cmatrix,sparse_cdot>(M1.A,M2);
02609 }
02610 
02612 
02618 inline cmatrix operator*(const cmatrix_slice& M1, const srmatrix_slice& M2) {
02619   return fsp_mm_mult<cmatrix,srmatrix,cmatrix,sparse_cdot>(M1,M2.A);
02620 }
02621 
02623 
02629 inline cmatrix operator*(const rmatrix_slice& M1, const scmatrix_slice& M2) {
02630   return fsp_mm_mult<rmatrix,scmatrix,cmatrix,sparse_cdot>(M1,M2.A);
02631 }
02632 
02634 
02640 inline cmatrix operator*(const cmatrix_slice& M1, const scmatrix_slice& M2) {
02641   return fsp_mm_mult<cmatrix,scmatrix,cmatrix,sparse_cdot>(M1,M2.A);
02642 }
02643 
02645 
02651 inline scvector operator*(const scmatrix_slice& M, const srvector& v) {
02652   return spsp_mv_mult<scmatrix,srvector,scvector,sparse_cdot,complex>(M.A,v);
02653 }
02654 
02656 
02662 inline scvector operator*(const srmatrix_slice& M, const scvector& v) {
02663   return spsp_mv_mult<srmatrix,scvector,scvector,sparse_cdot,complex>(M.A,v);
02664 }
02665 
02667 
02673 inline scvector operator*(const scmatrix_slice& M, const scvector& v) {
02674   return spsp_mv_mult<scmatrix,scvector,scvector,sparse_cdot,complex>(M.A,v);
02675 }
02676 
02678 
02684 inline scvector operator*(const scmatrix_slice& M, const srvector_slice& v) {
02685   return spsl_mv_mult<scmatrix,srvector_slice,scvector,sparse_cdot,complex>(M.A,v);
02686 }
02687 
02689 
02695 inline scvector operator*(const srmatrix_slice& M, const scvector_slice& v) {
02696   return spsl_mv_mult<srmatrix,scvector_slice,scvector,sparse_cdot,complex>(M.A,v);
02697 }
02698 
02700 
02706 inline scvector operator*(const scmatrix_slice& M, const scvector_slice& v) {
02707   return spsl_mv_mult<scmatrix,scvector_slice,scvector,sparse_cdot,complex>(M.A,v);
02708 }
02709 
02711 
02717 inline cvector operator*(const scmatrix_slice& M, const rvector& v) {
02718   return spf_mv_mult<scmatrix,rvector,cvector,sparse_cdot>(M.A,v);
02719 }
02720 
02722 
02728 inline cvector operator*(const srmatrix_slice& M, const cvector& v) {
02729   return spf_mv_mult<srmatrix,cvector,cvector,sparse_cdot>(M.A,v);
02730 }
02731 
02733 
02739 inline cvector operator*(const scmatrix_slice& M, const cvector& v) {
02740   return spf_mv_mult<scmatrix,cvector,cvector,sparse_cdot>(M.A,v);
02741 }
02742 
02744 
02750 inline cvector operator*(const scmatrix_slice& M, const rvector_slice& v) {
02751   return spf_mv_mult<scmatrix,rvector_slice,cvector,sparse_cdot>(M.A,v);
02752 }
02753 
02755 
02761 inline cvector operator*(const srmatrix_slice& M, const cvector_slice& v) {
02762   return spf_mv_mult<srmatrix,cvector_slice,cvector,sparse_cdot>(M.A,v);
02763 }
02764 
02766 
02772 inline cvector operator*(const scmatrix_slice& M, const cvector_slice& v) {
02773   return spf_mv_mult<scmatrix,cvector_slice,cvector,sparse_cdot>(M.A,v);
02774 }
02775 
02777 inline scmatrix operator*(const scmatrix_slice& M, const real& r) {
02778   return sp_ms_mult<scmatrix,real,scmatrix>(M.A,r);
02779 }
02780 
02782 inline scmatrix operator*(const scmatrix_slice& M, const complex& r) {
02783   return sp_ms_mult<scmatrix,complex,scmatrix>(M.A,r);
02784 }
02785 
02787 inline scmatrix operator*(const srmatrix_slice& M, const complex& r) {
02788   return sp_ms_mult<srmatrix,complex,scmatrix>(M.A,r);
02789 }
02790 
02792 inline scmatrix operator/(const scmatrix_slice& M, const real& r) {
02793   return sp_ms_div<scmatrix,real,scmatrix>(M.A,r);
02794 }
02795 
02797 inline scmatrix operator/(const scmatrix_slice& M, const complex& r) {
02798   return sp_ms_div<scmatrix,complex,scmatrix>(M.A,r);
02799 }
02800 
02802 inline scmatrix operator/(const srmatrix_slice& M, const complex& r) {
02803   return sp_ms_div<srmatrix,complex,scmatrix>(M.A,r);
02804 }
02805 
02807 inline scmatrix operator*(const real& r, const scmatrix_slice& M) {
02808   return sp_sm_mult<real,scmatrix,scmatrix>(r,M.A);
02809 }
02810 
02812 inline scmatrix operator*(const complex& r, const srmatrix_slice& M) {
02813   return sp_sm_mult<complex,srmatrix,scmatrix>(r,M.A);
02814 }
02815 
02817 inline scmatrix operator*(const complex& r, const scmatrix_slice& M) {
02818   return sp_sm_mult<complex,scmatrix,scmatrix>(r,M.A);
02819 }
02820 
02822 inline scmatrix operator+(const scmatrix_slice& M1, const srmatrix_slice& M2) {
02823   return spsp_mm_add<scmatrix,srmatrix,scmatrix,complex>(M1.A,M2.A);
02824 }
02825 
02827 inline scmatrix operator+(const srmatrix_slice& M1, const scmatrix_slice& M2) {
02828   return spsp_mm_add<srmatrix,scmatrix,scmatrix,complex>(M1.A,M2.A);
02829 }
02830 
02832 inline scmatrix operator+(const scmatrix_slice& M1, const scmatrix_slice& M2) {
02833   return spsp_mm_add<scmatrix,scmatrix,scmatrix,complex>(M1.A,M2.A);
02834 }
02835 
02837 inline scmatrix operator+(const scmatrix_slice& M1, const srmatrix& M2) {
02838   return spsp_mm_add<scmatrix,srmatrix,scmatrix,complex>(M1.A,M2);
02839 }
02840 
02842 inline scmatrix operator+(const srmatrix_slice& M1, const scmatrix& M2) {
02843   return spsp_mm_add<srmatrix,scmatrix,scmatrix,complex>(M1.A,M2);
02844 }
02845 
02847 inline scmatrix operator+(const scmatrix_slice& M1, const scmatrix& M2) {
02848   return spsp_mm_add<scmatrix,scmatrix,scmatrix,complex>(M1.A,M2);
02849 }
02850 
02852 inline scmatrix operator+(const scmatrix& M1, const srmatrix_slice& M2) {
02853   return spsp_mm_add<scmatrix,srmatrix,scmatrix,complex>(M1,M2.A);
02854 }
02855 
02857 inline scmatrix operator+(const srmatrix& M1, const scmatrix_slice& M2) {
02858   return spsp_mm_add<srmatrix,scmatrix,scmatrix,complex>(M1,M2.A);
02859 }
02860 
02862 inline scmatrix operator+(const scmatrix& M1, const scmatrix_slice& M2) {
02863   return spsp_mm_add<scmatrix,scmatrix,scmatrix,complex>(M1,M2.A);
02864 }
02865 
02867 inline cmatrix operator+(const scmatrix_slice& M1, const rmatrix& M2) {
02868   return spf_mm_add<scmatrix,rmatrix,cmatrix>(M1.A,M2);
02869 }
02870 
02872 inline cmatrix operator+(const srmatrix_slice& M1, const cmatrix& M2) {
02873   return spf_mm_add<srmatrix,cmatrix,cmatrix>(M1.A,M2);
02874 }
02875 
02877 inline cmatrix operator+(const scmatrix_slice& M1, const cmatrix& M2) {
02878   return spf_mm_add<scmatrix,cmatrix,cmatrix>(M1.A,M2);
02879 }
02880 
02882 inline cmatrix operator+(const cmatrix& M1, const srmatrix_slice& M2) {
02883   return fsp_mm_add<cmatrix,srmatrix,cmatrix>(M1,M2.A);
02884 }
02885 
02887 inline cmatrix operator+(const rmatrix& M1, const scmatrix_slice& M2) {
02888   return fsp_mm_add<rmatrix,scmatrix,cmatrix>(M1,M2.A);
02889 }
02890 
02892 inline cmatrix operator+(const cmatrix& M1, const scmatrix_slice& M2) {
02893   return fsp_mm_add<cmatrix,scmatrix,cmatrix>(M1,M2.A);
02894 }
02895 
02897 inline cmatrix operator+(const scmatrix_slice& M1, const rmatrix_slice& M2) {
02898   return spf_mm_add<scmatrix,rmatrix_slice,cmatrix>(M1.A,M2);
02899 }
02900 
02902 inline cmatrix operator+(const srmatrix_slice& M1, const cmatrix_slice& M2) {
02903   return spf_mm_add<srmatrix,cmatrix_slice,cmatrix>(M1.A,M2);
02904 }
02905 
02907 inline cmatrix operator+(const scmatrix_slice& M1, const cmatrix_slice& M2) {
02908   return spf_mm_add<scmatrix,cmatrix_slice,cmatrix>(M1.A,M2);
02909 }
02910 
02912 inline cmatrix operator+(const cmatrix_slice& M1, const srmatrix_slice& M2) {
02913   return fsp_mm_add<cmatrix_slice,srmatrix,cmatrix>(M1,M2.A);
02914 }
02915 
02917 inline cmatrix operator+(const rmatrix_slice& M1, const scmatrix_slice& M2) {
02918   return fsp_mm_add<rmatrix_slice,scmatrix,cmatrix>(M1,M2.A);
02919 }
02920 
02922 inline cmatrix operator+(const cmatrix_slice& M1, const scmatrix_slice& M2) {
02923   return fsp_mm_add<cmatrix_slice,scmatrix,cmatrix>(M1,M2.A);
02924 }
02925 
02927 inline scmatrix operator-(const scmatrix_slice& M1, const srmatrix_slice& M2) {
02928   return spsp_mm_sub<scmatrix,srmatrix,scmatrix,complex>(M1.A,M2.A);
02929 }
02930 
02932 inline scmatrix operator-(const srmatrix_slice& M1, const scmatrix_slice& M2) {
02933   return spsp_mm_sub<srmatrix,scmatrix,scmatrix,complex>(M1.A,M2.A);
02934 }
02935 
02937 inline scmatrix operator-(const scmatrix_slice& M1, const scmatrix_slice& M2) {
02938   return spsp_mm_sub<scmatrix,scmatrix,scmatrix,complex>(M1.A,M2.A);
02939 }
02940 
02942 inline scmatrix operator-(const scmatrix_slice& M1, const srmatrix& M2) {
02943   return spsp_mm_sub<scmatrix,srmatrix,scmatrix,complex>(M1.A,M2);
02944 }
02945 
02947 inline scmatrix operator-(const srmatrix_slice& M1, const scmatrix& M2) {
02948   return spsp_mm_sub<srmatrix,scmatrix,scmatrix,complex>(M1.A,M2);
02949 }
02950 
02952 inline scmatrix operator-(const scmatrix_slice& M1, const scmatrix& M2) {
02953   return spsp_mm_sub<scmatrix,scmatrix,scmatrix,complex>(M1.A,M2);
02954 }
02955 
02957 inline scmatrix operator-(const scmatrix& M1, const srmatrix_slice& M2) {
02958   return spsp_mm_sub<scmatrix,srmatrix,scmatrix,complex>(M1,M2.A);
02959 }
02960 
02962 inline scmatrix operator-(const srmatrix& M1, const scmatrix_slice& M2) {
02963   return spsp_mm_sub<srmatrix,scmatrix,scmatrix,complex>(M1,M2.A);
02964 }
02965 
02967 inline scmatrix operator-(const scmatrix& M1, const scmatrix_slice& M2) {
02968   return spsp_mm_sub<scmatrix,scmatrix,scmatrix,complex>(M1,M2.A);
02969 }
02970 
02972 inline cmatrix operator-(const scmatrix_slice& M1, const rmatrix& M2) {
02973   return spf_mm_sub<scmatrix,rmatrix,cmatrix>(M1.A,M2);
02974 }
02975 
02977 inline cmatrix operator-(const srmatrix_slice& M1, const cmatrix& M2) {
02978   return spf_mm_sub<srmatrix,cmatrix,cmatrix>(M1.A,M2);
02979 }
02980 
02982 inline cmatrix operator-(const scmatrix_slice& M1, const cmatrix& M2) {
02983   return spf_mm_sub<scmatrix,cmatrix,cmatrix>(M1.A,M2);
02984 }
02985 
02987 inline cmatrix operator-(const cmatrix& M1, const srmatrix_slice& M2) {
02988   return fsp_mm_sub<cmatrix,srmatrix,cmatrix>(M1,M2.A);
02989 }
02990 
02992 inline cmatrix operator-(const rmatrix& M1, const scmatrix_slice& M2) {
02993   return fsp_mm_sub<rmatrix,scmatrix,cmatrix>(M1,M2.A);
02994 }
02995 
02997 inline cmatrix operator-(const cmatrix& M1, const scmatrix_slice& M2) {
02998   return fsp_mm_sub<cmatrix,scmatrix,cmatrix>(M1,M2.A);
02999 }
03000 
03002 inline cmatrix operator-(const scmatrix_slice& M1, const rmatrix_slice& M2) {
03003   return spf_mm_sub<scmatrix,rmatrix_slice,cmatrix>(M1.A,M2);
03004 }
03005 
03007 inline cmatrix operator-(const srmatrix_slice& M1, const cmatrix_slice& M2) {
03008   return spf_mm_sub<srmatrix,cmatrix_slice,cmatrix>(M1.A,M2);
03009 }
03010 
03012 inline cmatrix operator-(const scmatrix_slice& M1, const cmatrix_slice& M2) {
03013   return spf_mm_sub<scmatrix,cmatrix_slice,cmatrix>(M1.A,M2);
03014 }
03015 
03017 inline cmatrix operator-(const cmatrix_slice& M1, const srmatrix_slice& M2) {
03018   return fsp_mm_sub<cmatrix_slice,srmatrix,cmatrix>(M1,M2.A);
03019 }
03020 
03022 inline cmatrix operator-(const rmatrix_slice& M1, const scmatrix_slice& M2) {
03023   return fsp_mm_sub<rmatrix_slice,scmatrix,cmatrix>(M1,M2.A);
03024 }
03025 
03027 inline cmatrix operator-(const cmatrix_slice& M1, const scmatrix_slice& M2) {
03028   return fsp_mm_sub<cmatrix_slice,scmatrix,cmatrix>(M1,M2.A);
03029 }
03030 
03031 inline cmatrix& cmatrix::operator=(const srmatrix_slice& M) {
03032   *this = rmatrix(M);
03033   return *this;
03034 }
03035 
03036 inline cmatrix& cmatrix::operator=(const scmatrix_slice& M) {
03037   *this = cmatrix(M);
03038   return *this;
03039 }
03040 
03041 inline cmatrix& cmatrix::operator+=(const srmatrix_slice& M) {
03042   *this += M.A;
03043   return *this;
03044 }
03045 
03046 inline cmatrix& cmatrix::operator+=(const scmatrix_slice& M) {
03047   *this += M.A;
03048   return *this;
03049 }
03050 
03051 inline cmatrix_slice& cmatrix_slice::operator+=(const srmatrix_slice& M) {
03052   *this += M.A;
03053   return *this;
03054 }
03055 
03056 inline cmatrix_slice& cmatrix_slice::operator+=(const scmatrix_slice& M) {
03057   *this += M.A;
03058   return *this;
03059 }
03060 
03061 inline cmatrix& cmatrix::operator-=(const srmatrix_slice& M) {
03062   *this -= M.A;
03063   return *this;
03064 }
03065 
03066 inline cmatrix& cmatrix::operator-=(const scmatrix_slice& M) {
03067   *this -= M.A;
03068   return *this;
03069 }
03070 
03071 inline cmatrix_slice& cmatrix_slice::operator-=(const srmatrix_slice& M) {
03072   *this -= M.A;
03073   return *this;
03074 }
03075 
03076 inline cmatrix_slice& cmatrix_slice::operator-=(const scmatrix_slice& M) {
03077   *this -= M.A;
03078   return *this;
03079 }
03080 
03081 inline cmatrix& cmatrix::operator*=(const srmatrix_slice& M) {
03082   *this *= M.A;
03083   return *this;
03084 }
03085 
03086 inline cmatrix& cmatrix::operator*=(const scmatrix_slice& M) {
03087   *this *= M.A;
03088   return *this;
03089 }
03090 
03091 inline cmatrix_slice& cmatrix_slice::operator*=(const srmatrix_slice& M) {
03092   *this *= M.A;
03093   return *this;
03094 }
03095 
03096 inline cmatrix_slice& cmatrix_slice::operator*=(const scmatrix_slice& M) {
03097   *this *= M.A;
03098   return *this;
03099 }
03100 
03102 inline bool operator==(const scmatrix_slice& M1, const srmatrix_slice& M2) {
03103   return spsp_mm_comp(M1.A,M2.A);
03104 }
03105 
03107 inline bool operator==(const srmatrix_slice& M1, const scmatrix_slice& M2) {
03108   return spsp_mm_comp(M1.A,M2.A);
03109 }
03110 
03112 inline bool operator==(const scmatrix_slice& M1, const scmatrix_slice& M2) {
03113   return spsp_mm_comp(M1.A,M2.A);
03114 }
03115 
03117 inline bool operator==(const scmatrix_slice& M1, const srmatrix& M2) {
03118   return spsp_mm_comp(M1.A,M2);
03119 }
03120 
03122 inline bool operator==(const srmatrix_slice& M1, const scmatrix& M2) {
03123   return spsp_mm_comp(M1.A,M2);
03124 }
03125 
03127 inline bool operator==(const scmatrix_slice& M1, const scmatrix& M2) {
03128   return spsp_mm_comp(M1.A,M2);
03129 }
03130 
03132 inline bool operator==(const scmatrix& M1, const srmatrix_slice& M2) {
03133   return spsp_mm_comp(M1,M2.A);
03134 }
03135 
03137 inline bool operator==(const srmatrix& M1, const scmatrix_slice& M2) {
03138   return spsp_mm_comp(M1,M2.A);
03139 }
03140 
03142 inline bool operator==(const scmatrix& M1, const scmatrix_slice& M2) {
03143   return spsp_mm_comp(M1,M2.A);
03144 }
03145 
03147 inline bool operator==(const scmatrix_slice& M1, const rmatrix& M2) {
03148   return spf_mm_comp(M1.A,M2);
03149 }
03150 
03152 inline bool operator==(const srmatrix_slice& M1, const cmatrix& M2) {
03153   return spf_mm_comp(M1.A,M2);
03154 }
03155 
03157 inline bool operator==(const scmatrix_slice& M1, const cmatrix& M2) {
03158   return spf_mm_comp(M1.A,M2);
03159 }
03160 
03162 inline bool operator==(const cmatrix& M1, const srmatrix_slice& M2) {
03163   return fsp_mm_comp(M1,M2.A);
03164 }
03165 
03167 inline bool operator==(const rmatrix& M1, const scmatrix_slice& M2) {
03168   return fsp_mm_comp(M1,M2.A);
03169 }
03170 
03172 inline bool operator==(const cmatrix& M1, const scmatrix_slice& M2) {
03173   return fsp_mm_comp(M1,M2.A);
03174 }
03175 
03177 inline bool operator==(const cmatrix_slice& M1, const srmatrix_slice& M2) {
03178   return fsp_mm_comp(M1,M2.A);
03179 }
03180 
03182 inline bool operator==(const rmatrix_slice& M1, const scmatrix_slice& M2) {
03183   return fsp_mm_comp(M1,M2.A);
03184 }
03185 
03187 inline bool operator==(const cmatrix_slice& M1, const scmatrix_slice& M2) {
03188   return fsp_mm_comp(M1,M2.A);
03189 }
03190 
03192 inline bool operator==(const scmatrix_slice& M1, const rmatrix_slice& M2) {
03193   return spf_mm_comp(M1.A,M2);
03194 }
03195 
03197 inline bool operator==(const srmatrix_slice& M1, const cmatrix_slice& M2) {
03198   return spf_mm_comp(M1.A,M2);
03199 }
03200 
03202 inline bool operator==(const scmatrix_slice& M1, const cmatrix_slice& M2) {
03203   return spf_mm_comp(M1.A,M2);
03204 }
03205 
03207 inline bool operator!=(const scmatrix_slice& M1, const srmatrix_slice& M2) {
03208   return !spsp_mm_comp(M1.A,M2.A);
03209 }
03210 
03212 inline bool operator!=(const srmatrix_slice& M1, const scmatrix_slice& M2) {
03213   return !spsp_mm_comp(M1.A,M2.A);
03214 }
03215 
03217 inline bool operator!=(const scmatrix_slice& M1, const scmatrix_slice& M2) {
03218   return !spsp_mm_comp(M1.A,M2.A);
03219 }
03220 
03222 inline bool operator!=(const scmatrix_slice& M1, const srmatrix& M2) {
03223   return !spsp_mm_comp(M1.A,M2);
03224 }
03225 
03227 inline bool operator!=(const srmatrix_slice& M1, const scmatrix& M2) {
03228   return !spsp_mm_comp(M1.A,M2);
03229 }
03230 
03232 inline bool operator!=(const scmatrix_slice& M1, const scmatrix& M2) {
03233   return !spsp_mm_comp(M1.A,M2);
03234 }
03235 
03237 inline bool operator!=(const scmatrix& M1, const srmatrix_slice& M2) {
03238   return !spsp_mm_comp(M1,M2.A);
03239 }
03240 
03242 inline bool operator!=(const srmatrix& M1, const scmatrix_slice& M2) {
03243   return !spsp_mm_comp(M1,M2.A);
03244 }
03245 
03247 inline bool operator!=(const scmatrix& M1, const scmatrix_slice& M2) {
03248   return !spsp_mm_comp(M1,M2.A);
03249 }
03250 
03252 inline bool operator!=(const scmatrix_slice& M1, const rmatrix& M2) {
03253   return !spf_mm_comp(M1.A,M2);
03254 }
03255 
03257 inline bool operator!=(const srmatrix_slice& M1, const cmatrix& M2) {
03258   return !spf_mm_comp(M1.A,M2);
03259 }
03260 
03262 inline bool operator!=(const scmatrix_slice& M1, const cmatrix& M2) {
03263   return !spf_mm_comp(M1.A,M2);
03264 }
03265 
03267 inline bool operator!=(const cmatrix& M1, const srmatrix_slice& M2) {
03268   return !fsp_mm_comp(M1,M2.A);
03269 }
03270 
03272 inline bool operator!=(const rmatrix& M1, const scmatrix_slice& M2) {
03273   return !fsp_mm_comp(M1,M2.A);
03274 }
03275 
03277 inline bool operator!=(const cmatrix& M1, const scmatrix_slice& M2) {
03278   return !fsp_mm_comp(M1,M2.A);
03279 }
03280 
03282 inline bool operator!=(const cmatrix_slice& M1, const srmatrix_slice& M2) {
03283   return !fsp_mm_comp(M1,M2.A);
03284 }
03285 
03287 inline bool operator!=(const rmatrix_slice& M1, const scmatrix_slice& M2) {
03288   return !fsp_mm_comp(M1,M2.A);
03289 }
03290 
03292 inline bool operator!=(const cmatrix_slice& M1, const scmatrix_slice& M2) {
03293   return !fsp_mm_comp(M1,M2.A);
03294 }
03295 
03297 inline bool operator!=(const scmatrix_slice& M1, const rmatrix_slice& M2) {
03298   return !spf_mm_comp(M1.A,M2);
03299 }
03300 
03302 inline bool operator!=(const srmatrix_slice& M1, const cmatrix_slice& M2) {
03303   return !spf_mm_comp(M1.A,M2);
03304 }
03305 
03307 inline bool operator!=(const scmatrix_slice& M1, const cmatrix_slice& M2) {
03308   return !spf_mm_comp(M1.A,M2);
03309 }
03310 
03312 inline bool operator!(const scmatrix_slice& M) {
03313   return sp_m_not(M.A);
03314 }
03315 
03317 
03322 inline std::ostream& operator<<(std::ostream& os, const scmatrix_slice& M) {
03323   return sp_m_output<scmatrix,complex>(os, M.A);
03324 }
03325 
03327 
03332 inline std::istream& operator>>(std::istream& is, scmatrix_slice& M) {
03333   scmatrix tmp(M.A.m, M.A.n);
03334   is >> tmp;
03335   M = tmp;
03336   return is;
03337 }
03338 
03340 
03345 class scmatrix_subv {
03346   private:
03347     scmatrix_slice dat;
03348     bool row;
03349     int index;
03350 
03351     scmatrix_subv(scmatrix& A, bool r, int i, int j, int k, int l) : dat(A,i,j,k,l), row(r) {
03352        if(row) index=i; else index=k;
03353     }
03354 
03355     scmatrix_subv(const scmatrix& A, bool r, int i, int j, int k, int l) : dat(A,i,j,k,l), row(r) {
03356        if(row) index=i; else index=k;
03357     }
03358 
03359   
03360   public:
03362 
03366     complex& operator[](const int i) {
03367       if(row) {
03368 #if(CXSC_INDEX_CHECK)
03369         if(i<dat.A.lb2 || i>dat.A.ub2)
03370           cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_subv::operator[](int)"));
03371 #endif
03372         return dat.element(index,i);
03373       } else {
03374 #if(CXSC_INDEX_CHECK)
03375         if(i<dat.A.lb1 || i>dat.A.ub1)
03376           cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_subv::operator[](int)"));
03377 #endif
03378         return dat.element(i,index);
03379       }
03380     }
03381 
03383 
03386     const complex operator[](const int i) const {
03387       if(row) {
03388 #if(CXSC_INDEX_CHECK)
03389         if(i<dat.A.lb2 || i>dat.A.ub2)
03390           cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_subv::operator[](int)"));
03391 #endif
03392         return dat(index,i);
03393       } else {
03394 #if(CXSC_INDEX_CHECK)
03395         if(i<dat.A.lb1 || i>dat.A.ub1)
03396           cxscthrow(ELEMENT_NOT_IN_VEC("scmatrix_subv::operator[](int)"));
03397 #endif
03398         return dat(i,index);
03399       }
03400     }
03401 
03403     scmatrix_subv& operator=(const real& v) {
03404       return sv_vs_assign(*this,v);
03405     }
03406 
03408     scmatrix_subv& operator=(const complex& v) {
03409       return sv_vs_assign(*this,v);
03410     }
03411 
03413     scmatrix_subv& operator=(const srvector& v) {
03414       return svsp_vv_assign(*this,v);
03415     }
03416 
03418     scmatrix_subv& operator=(const scvector& v) {
03419       return svsp_vv_assign(*this,v);
03420     }
03421 
03423     scmatrix_subv& operator=(const srvector_slice& v) {
03424       return svsl_vv_assign(*this,v);
03425     }
03426 
03428     scmatrix_subv& operator=(const scvector_slice& v) {
03429       return svsl_vv_assign(*this,v);
03430     }
03431 
03433     scmatrix_subv& operator=(const rvector& v) {
03434       return svf_vv_assign(*this,v);
03435     }
03436 
03438     scmatrix_subv& operator=(const cvector& v) {
03439       return svf_vv_assign(*this,v);
03440     }
03441 
03443     scmatrix_subv& operator=(const rvector_slice& v) {
03444       return svf_vv_assign(*this,v);
03445     }
03446 
03448     scmatrix_subv& operator=(const cvector_slice& v) {
03449       return svf_vv_assign(*this,v);
03450     }
03451 
03453     scmatrix_subv& operator=(const srmatrix_subv& v) {
03454       return svsp_vv_assign(*this,srvector(v));
03455     }
03456 
03458     scmatrix_subv& operator=(const scmatrix_subv& v) {
03459       return svsp_vv_assign(*this,scvector(v));
03460     }
03461 
03462 
03464     scmatrix_subv& operator*=(const real&);
03466     scmatrix_subv& operator*=(const complex&);
03468     scmatrix_subv& operator/=(const real&);
03470     scmatrix_subv& operator/=(const complex&);
03472     scmatrix_subv& operator+=(const srvector&);
03474     scmatrix_subv& operator+=(const srvector_slice&);
03476     scmatrix_subv& operator+=(const rvector&);
03478     scmatrix_subv& operator+=(const rvector_slice&);
03480     scmatrix_subv& operator-=(const srvector&);
03482     scmatrix_subv& operator-=(const srvector_slice&);
03484     scmatrix_subv& operator-=(const rvector&);
03486     scmatrix_subv& operator-=(const rvector_slice&);
03488     scmatrix_subv& operator+=(const scvector&);
03490     scmatrix_subv& operator+=(const scvector_slice&);
03492     scmatrix_subv& operator+=(const cvector&);
03494     scmatrix_subv& operator+=(const cvector_slice&);
03496     scmatrix_subv& operator-=(const scvector&);
03498     scmatrix_subv& operator-=(const scvector_slice&);
03500     scmatrix_subv& operator-=(const cvector&);
03502     scmatrix_subv& operator-=(const cvector_slice&);
03503 
03504     friend scvector operator-(const scmatrix_subv&);
03505     friend std::istream& operator>>(std::istream&, scmatrix_subv&);
03506 
03507     friend int Lb(const scmatrix_subv&);
03508     friend int Ub(const scmatrix_subv&);
03509     friend int VecLen(const scmatrix_subv&);
03510     friend srvector Re(const scmatrix_subv&);
03511     friend srvector Im(const scmatrix_subv&);
03512 
03513     friend class srvector;
03514     friend class srmatrix;
03515     friend class srmatrix_slice;
03516     friend class scvector;
03517     friend class scmatrix;
03518     friend class scmatrix_slice;
03519     friend class scivector;
03520     friend class scimatrix;
03521     friend class scimatrix_slice;
03522 
03523 #include "vector_friend_declarations.inl"
03524 };
03525 
03527 inline int Lb(const scmatrix_subv& S) {
03528   if(S.row)
03529     return Lb(S.dat, 2);
03530   else
03531     return Lb(S.dat, 1);
03532 }
03533 
03535 inline int Ub(const scmatrix_subv& S) {
03536   if(S.row)
03537     return Ub(S.dat, 2);
03538   else
03539     return Ub(S.dat, 1);
03540 }
03541 
03543 inline int VecLen(const scmatrix_subv& S) {
03544   return Ub(S)-Lb(S)+1;
03545 }
03546 
03548 inline srvector Re(const scmatrix_subv& S) {
03549   return Re(scvector(S));
03550 }
03551 
03553 inline srvector Im(const scmatrix_subv& S) {
03554   return Im(scvector(S));
03555 }
03556 
03558 inline std::ostream& operator<<(std::ostream& os, const scmatrix_subv& v) {
03559   os << scvector(v);
03560   return os;
03561 }
03562 
03564 inline std::istream& operator>>(std::istream& is, scmatrix_subv& v) {
03565   int n=0;
03566   if(v.row) n=v.dat.A.n; else n=v.dat.A.m;
03567   scvector tmp(n);
03568   is >> tmp;
03569   v = tmp;
03570   return is;
03571 }
03572 
03573 inline scmatrix_subv scmatrix::operator[](const cxscmatrix_column& c) {
03574 #if(CXSC_INDEX_CHECK)
03575   if(c.col()<lb2 || c.col()>ub2)
03576     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator[](const cxscmatrix_column&)"));
03577 #endif
03578   return scmatrix_subv(*this, false, lb1, ub1, c.col(), c.col());
03579 }
03580 
03581 inline scmatrix_subv scmatrix::operator[](const int i) {
03582 #if(CXSC_INDEX_CHECK)
03583   if(i<lb1 || i>ub1)
03584     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator[](const int)"));
03585 #endif
03586   return scmatrix_subv(*this, true, i, i, lb2, ub2);
03587 }
03588 
03589 inline const scmatrix_subv scmatrix::operator[](const cxscmatrix_column& c) const {
03590 #if(CXSC_INDEX_CHECK)
03591   if(c.col()<lb2 || c.col()>ub2)
03592     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator[](const cxscmatrix_column&)"));
03593 #endif
03594   return scmatrix_subv(*this, false, lb1, ub1, c.col(), c.col());
03595 }
03596 
03597 inline const scmatrix_subv scmatrix::operator[](const int i) const {
03598 #if(CXSC_INDEX_CHECK)
03599   if(i<lb1 || i>ub1)
03600     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix::operator[](const int)"));
03601 #endif
03602   return scmatrix_subv(*this, true, i, i, lb2, ub2);
03603 }
03604 
03605 inline scmatrix_subv scmatrix_slice::operator[](const int i) {
03606 #if(CXSC_INDEX_CHECK)
03607   if(i<A.lb1 || i>A.ub1)
03608     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix_slice::operator[](const int)"));
03609 #endif
03610   return scmatrix_subv(*M, true, i, i, A.lb2, A.ub2);
03611 }
03612 
03613 inline scmatrix_subv scmatrix_slice::operator[](const cxscmatrix_column& c) {
03614 #if(CXSC_INDEX_CHECK)
03615   if(c.col()<A.lb2 || c.col()>A.ub2)
03616     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix_slice::operator[](const cxscmatrix_column&)"));
03617 #endif
03618   return scmatrix_subv(*M, false, A.lb1, A.ub1, c.col(), c.col());
03619 }
03620 
03621 inline const scmatrix_subv scmatrix_slice::operator[](const int i) const {
03622 #if(CXSC_INDEX_CHECK)
03623   if(i<A.lb1 || i>A.ub1)
03624     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix_slice::operator[](const int)"));
03625 #endif
03626   return scmatrix_subv(*M, true, i, i, A.lb2, A.ub2);
03627 }
03628 
03629 inline const scmatrix_subv scmatrix_slice::operator[](const cxscmatrix_column& c) const {
03630 #if(CXSC_INDEX_CHECK)
03631   if(c.col()<A.lb2 || c.col()>A.ub2)
03632     cxscthrow(ROW_OR_COL_NOT_IN_MAT("scmatrix_slice::operator[](const cxscmatrix_column&)"));
03633 #endif
03634   return scmatrix_subv(*M, false, A.lb1, A.ub1, c.col(), c.col());
03635 }
03636 
03637 inline scvector::scvector(const scmatrix_subv& A) {
03638   int nnz = A.dat.A.get_nnz();
03639   p.reserve(nnz);
03640   x.reserve(nnz);
03641 
03642   if(A.row) {
03643     lb = A.dat.A.lb2;
03644     ub = A.dat.A.ub2;
03645     n = ub-lb+1; 
03646 
03647     for(int j=0 ; j<n ; j++) {
03648       for(int k=A.dat.A.p[j] ; k<A.dat.A.p[j+1] ; k++) {
03649         p.push_back(j);
03650         x.push_back(A.dat.A.x[k]);
03651       }
03652     }
03653 
03654   } else {
03655     lb = A.dat.A.lb1;
03656     ub = A.dat.A.ub1;
03657     n = ub-lb+1; 
03658 
03659     for(unsigned int k=0 ; k<A.dat.A.ind.size() ; k++) {
03660         p.push_back(A.dat.A.ind[k]);
03661         x.push_back(A.dat.A.x[k]);
03662     }
03663   }
03664 }
03665 
03667 inline scvector operator-(const scmatrix_subv& v) {
03668  scvector s(v);
03669  return -s;
03670 }
03671 
03673 inline scvector operator/(const scmatrix_subv& v1, const real& v2) {
03674   return scvector(v1) / v2;
03675 }
03676 
03678 inline scvector operator/(const scmatrix_subv& v1, const complex& v2) {
03679   return scvector(v1) / v2;
03680 }
03681 
03683 inline scvector operator/(const srmatrix_subv& v1, const complex& v2) {
03684   return srvector(v1) / v2;
03685 }
03686 
03688 inline scvector operator*(const scmatrix_subv& v1, const real& v2) {
03689   return scvector(v1) * v2;
03690 }
03691 
03693 inline scvector operator*(const scmatrix_subv& v1, const complex& v2) {
03694   return scvector(v1) * v2;
03695 }
03696 
03698 inline scvector operator*(const srmatrix_subv& v1, const complex& v2) {
03699   return srvector(v1) * v2;
03700 }
03701 
03703 inline scvector operator*(const real& v1, const scmatrix_subv& v2) {
03704   return v1 * scvector(v2);
03705 }
03706 
03708 inline scvector operator*(const complex& v1, const scmatrix_subv& v2) {
03709   return v1 * scvector(v2);
03710 }
03711 
03713 inline scvector operator*(const complex& v1, const srmatrix_subv& v2) {
03714   return v1 * srvector(v2);
03715 }
03716 
03718 
03724 inline complex operator*(const scmatrix_subv& v1, const srvector& v2) {
03725   return scvector(v1) * v2;
03726 }
03727 
03729 
03735 inline complex operator*(const srmatrix_subv& v1, const scvector& v2) {
03736   return srvector(v1) * v2;
03737 }
03738 
03740 
03746 inline complex operator*(const scmatrix_subv& v1, const scvector& v2) {
03747   return scvector(v1) * v2;
03748 }
03749 
03751 
03757 inline complex operator*(const scmatrix_subv& v1, const srvector_slice& v2) {
03758   return scvector(v1) * v2;
03759 }
03760 
03762 
03768 inline complex operator*(const srmatrix_subv& v1, const scvector_slice& v2) {
03769   return srvector(v1) * v2;
03770 }
03771 
03773 
03779 inline complex operator*(const scmatrix_subv& v1, const scvector_slice& v2) {
03780   return scvector(v1) * v2;
03781 }
03782 
03784 
03790 inline complex operator*(const scmatrix_subv& v1, const rvector& v2) {
03791   return scvector(v1) * v2;
03792 }
03793 
03795 
03801 inline complex operator*(const srmatrix_subv& v1, const cvector& v2) {
03802   return srvector(v1) * v2;
03803 }
03804 
03806 
03812 inline complex operator*(const scmatrix_subv& v1, const cvector& v2) {
03813   return scvector(v1) * v2;
03814 }
03815 
03817 
03823 inline complex operator*(const scmatrix_subv& v1, const rvector_slice& v2) {
03824   return scvector(v1) * v2;
03825 }
03826 
03828 
03834 inline complex operator*(const srmatrix_subv& v1, const cvector_slice& v2) {
03835   return srvector(v1) * v2;
03836 }
03837 
03839 
03845 inline complex operator*(const scmatrix_subv& v1, const cvector_slice& v2) {
03846   return scvector(v1) * v2;
03847 }
03848 
03850 
03856 inline complex operator*(const scvector& v1, const srmatrix_subv& v2) {
03857   return v1 * srvector(v2);
03858 }
03859 
03861 
03867 inline complex operator*(const srvector& v1, const scmatrix_subv& v2) {
03868   return v1 * scvector(v2);
03869 }
03870 
03872 
03878 inline complex operator*(const scvector& v1, const scmatrix_subv& v2) {
03879   return v1 * scvector(v2);
03880 }
03881 
03883 
03889 inline complex operator*(const scvector_slice& v1, const srmatrix_subv& v2) {
03890   return v1 * srvector(v2);
03891 }
03892 
03894 
03900 inline complex operator*(const srvector_slice& v1, const scmatrix_subv& v2) {
03901   return v1 * scvector(v2);
03902 }
03903 
03905 
03911 inline complex operator*(const scvector_slice& v1, const scmatrix_subv& v2) {
03912   return v1 * scvector(v2);
03913 }
03914 
03916 
03922 inline complex operator*(const cvector& v1, const srmatrix_subv& v2) {
03923   return v1 * srvector(v2);
03924 }
03925 
03927 
03933 inline complex operator*(const rvector& v1, const scmatrix_subv& v2) {
03934   return v1 * scvector(v2);
03935 }
03936 
03938 
03944 inline complex operator*(const cvector& v1, const scmatrix_subv& v2) {
03945   return v1 * scvector(v2);
03946 }
03947 
03949 
03955 inline complex operator*(const cvector_slice& v1, const srmatrix_subv& v2) {
03956   return v1 * srvector(v2);
03957 }
03958 
03960 
03966 inline complex operator*(const rvector_slice& v1, const scmatrix_subv& v2) {
03967   return v1 * scvector(v2);
03968 }
03969 
03971 
03977 inline complex operator*(const cvector_slice& v1, const scmatrix_subv& v2) {
03978   return v1 * scvector(v2);
03979 }
03980 
03982 inline scvector operator+(const scmatrix_subv& v1, const srvector& v2) {
03983   return scvector(v1) + v2;
03984 }
03985 
03987 inline scvector operator+(const srmatrix_subv& v1, const scvector& v2) {
03988   return srvector(v1) + v2;
03989 }
03990 
03992 inline scvector operator+(const scmatrix_subv& v1, const scvector& v2) {
03993   return scvector(v1) + v2;
03994 }
03995 
03997 inline scvector operator+(const scmatrix_subv& v1, const srvector_slice& v2) {
03998   return scvector(v1) + v2;
03999 }
04000 
04002 inline scvector operator+(const srmatrix_subv& v1, const scvector_slice& v2) {
04003   return srvector(v1) + v2;
04004 }
04005 
04007 inline scvector operator+(const scmatrix_subv& v1, const scvector_slice& v2) {
04008   return scvector(v1) + v2;
04009 }
04010 
04012 inline cvector operator+(const scmatrix_subv& v1, const rvector& v2) {
04013   return scvector(v1) + v2;
04014 }
04015 
04017 inline cvector operator+(const srmatrix_subv& v1, const cvector& v2) {
04018   return srvector(v1) + v2;
04019 }
04020 
04022 inline cvector operator+(const scmatrix_subv& v1, const cvector& v2) {
04023   return scvector(v1) + v2;
04024 }
04025 
04027 inline cvector operator+(const scmatrix_subv& v1, const rvector_slice& v2) {
04028   return scvector(v1) + v2;
04029 }
04030 
04032 inline cvector operator+(const srmatrix_subv& v1, const cvector_slice& v2) {
04033   return srvector(v1) + v2;
04034 }
04035 
04037 inline cvector operator+(const scmatrix_subv& v1, const cvector_slice& v2) {
04038   return scvector(v1) + v2;
04039 }
04040 
04042 inline scvector operator+(const scvector& v1, const srmatrix_subv& v2) {
04043   return v1 + srvector(v2);
04044 }
04045 
04047 inline scvector operator+(const srvector& v1, const scmatrix_subv& v2) {
04048   return v1 + scvector(v2);
04049 }
04050 
04052 inline scvector operator+(const scvector& v1, const scmatrix_subv& v2) {
04053   return v1 + scvector(v2);
04054 }
04055 
04057 inline scvector operator+(const scvector_slice& v1, const srmatrix_subv& v2) {
04058   return v1 + srvector(v2);
04059 }
04060 
04062 inline scvector operator+(const srvector_slice& v1, const scmatrix_subv& v2) {
04063   return v1 + scvector(v2);
04064 }
04065 
04067 inline scvector operator+(const scvector_slice& v1, const scmatrix_subv& v2) {
04068   return v1 + scvector(v2);
04069 }
04070 
04072 inline cvector operator+(const cvector& v1, const srmatrix_subv& v2) {
04073   return v1 + srvector(v2);
04074 }
04075 
04077 inline cvector operator+(const rvector& v1, const scmatrix_subv& v2) {
04078   return v1 + scvector(v2);
04079 }
04080 
04082 inline cvector operator+(const cvector& v1, const scmatrix_subv& v2) {
04083   return v1 + scvector(v2);
04084 }
04085 
04087 inline cvector operator+(const cvector_slice& v1, const srmatrix_subv& v2) {
04088   return v1 + srvector(v2);
04089 }
04090 
04092 inline cvector operator+(const rvector_slice& v1, const scmatrix_subv& v2) {
04093   return v1 + scvector(v2);
04094 }
04095 
04097 inline cvector operator+(const cvector_slice& v1, const scmatrix_subv& v2) {
04098   return v1 + scvector(v2);
04099 }
04100 
04102 inline scvector operator-(const scmatrix_subv& v1, const srvector& v2) {
04103   return scvector(v1) - v2;
04104 }
04105 
04107 inline scvector operator-(const srmatrix_subv& v1, const scvector& v2) {
04108   return srvector(v1) - v2;
04109 }
04110 
04112 inline scvector operator-(const scmatrix_subv& v1, const scvector& v2) {
04113   return scvector(v1) - v2;
04114 }
04115 
04117 inline scvector operator-(const scmatrix_subv& v1, const srvector_slice& v2) {
04118   return scvector(v1) - v2;
04119 }
04120 
04122 inline scvector operator-(const srmatrix_subv& v1, const scvector_slice& v2) {
04123   return srvector(v1) - v2;
04124 }
04125 
04127 inline scvector operator-(const scmatrix_subv& v1, const scvector_slice& v2) {
04128   return scvector(v1) - v2;
04129 }
04130 
04132 inline cvector operator-(const scmatrix_subv& v1, const rvector& v2) {
04133   return scvector(v1) - v2;
04134 }
04135 
04137 inline cvector operator-(const srmatrix_subv& v1, const cvector& v2) {
04138   return srvector(v1) - v2;
04139 }
04140 
04142 inline cvector operator-(const scmatrix_subv& v1, const cvector& v2) {
04143   return scvector(v1) - v2;
04144 }
04145 
04147 inline cvector operator-(const scmatrix_subv& v1, const rvector_slice& v2) {
04148   return scvector(v1) - v2;
04149 }
04150 
04152 inline cvector operator-(const srmatrix_subv& v1, const cvector_slice& v2) {
04153   return srvector(v1) - v2;
04154 }
04155 
04157 inline cvector operator-(const scmatrix_subv& v1, const cvector_slice& v2) {
04158   return scvector(v1) - v2;
04159 }
04160 
04162 inline scvector operator-(const scvector& v1, const srmatrix_subv& v2) {
04163   return v1 - srvector(v2);
04164 }
04165 
04167 inline scvector operator-(const srvector& v1, const scmatrix_subv& v2) {
04168   return v1 - scvector(v2);
04169 }
04170 
04172 inline scvector operator-(const scvector& v1, const scmatrix_subv& v2) {
04173   return v1 - scvector(v2);
04174 }
04175 
04177 inline scvector operator-(const scvector_slice& v1, const srmatrix_subv& v2) {
04178   return v1 - srvector(v2);
04179 }
04180 
04182 inline scvector operator-(const srvector_slice& v1, const scmatrix_subv& v2) {
04183   return v1 - scvector(v2);
04184 }
04185 
04187 inline scvector operator-(const scvector_slice& v1, const scmatrix_subv& v2) {
04188   return v1 - scvector(v2);
04189 }
04190 
04192 inline cvector operator-(const cvector& v1, const srmatrix_subv& v2) {
04193   return v1 - srvector(v2);
04194 }
04195 
04197 inline cvector operator-(const rvector& v1, const scmatrix_subv& v2) {
04198   return v1 - scvector(v2);
04199 }
04200 
04202 inline cvector operator-(const cvector& v1, const scmatrix_subv& v2) {
04203   return v1 - scvector(v2);
04204 }
04205 
04207 inline cvector operator-(const cvector_slice& v1, const srmatrix_subv& v2) {
04208   return v1 - srvector(v2);
04209 }
04210 
04212 inline cvector operator-(const rvector_slice& v1, const scmatrix_subv& v2) {
04213   return v1 - scvector(v2);
04214 }
04215 
04217 inline cvector operator-(const cvector_slice& v1, const scmatrix_subv& v2) {
04218   return v1 - scvector(v2);
04219 }
04220 
04221 inline scmatrix_subv& scmatrix_subv::operator*=(const real& v) {
04222   *this = *this * v;
04223   return *this;
04224 }
04225 
04226 inline scmatrix_subv& scmatrix_subv::operator*=(const complex& v) {
04227   *this = *this * v;
04228   return *this;
04229 }
04230 
04231 inline scmatrix_subv& scmatrix_subv::operator/=(const real& v) {
04232   *this = *this / v;
04233   return *this;
04234 }
04235 
04236 inline scmatrix_subv& scmatrix_subv::operator/=(const complex& v) {
04237   *this = *this / v;
04238   return *this;
04239 }
04240 
04241 inline scmatrix_subv& scmatrix_subv::operator+=(const srvector& v) {
04242   *this = *this + v;
04243   return *this;
04244 }
04245 
04246 inline scmatrix_subv& scmatrix_subv::operator+=(const srvector_slice& v) {
04247   *this = *this + v;
04248   return *this;
04249 }
04250 
04251 inline scmatrix_subv& scmatrix_subv::operator+=(const rvector& v) {
04252   *this = *this + v;
04253   return *this;
04254 }
04255 
04256 inline scmatrix_subv& scmatrix_subv::operator+=(const rvector_slice& v) {
04257   *this = *this + v;
04258   return *this;
04259 }
04260 
04261 inline scmatrix_subv& scmatrix_subv::operator-=(const srvector& v) {
04262   *this = *this - v;
04263   return *this;
04264 }
04265 
04266 inline scmatrix_subv& scmatrix_subv::operator-=(const srvector_slice& v) {
04267   *this = *this - v;
04268   return *this;
04269 }
04270 
04271 inline scmatrix_subv& scmatrix_subv::operator-=(const rvector& v) {
04272   *this = *this - v;
04273   return *this;
04274 }
04275 
04276 inline scmatrix_subv& scmatrix_subv::operator-=(const rvector_slice& v) {
04277   *this = *this - v;
04278   return *this;
04279 }
04280 
04281 inline scmatrix_subv& scmatrix_subv::operator+=(const scvector& v) {
04282   *this = *this + v;
04283   return *this;
04284 }
04285 
04286 inline scmatrix_subv& scmatrix_subv::operator+=(const scvector_slice& v) {
04287   *this = *this + v;
04288   return *this;
04289 }
04290 
04291 inline scmatrix_subv& scmatrix_subv::operator+=(const cvector& v) {
04292   *this = *this + v;
04293   return *this;
04294 }
04295 
04296 inline scmatrix_subv& scmatrix_subv::operator+=(const cvector_slice& v) {
04297   *this = *this + v;
04298   return *this;
04299 }
04300 
04301 inline scmatrix_subv& scmatrix_subv::operator-=(const scvector& v) {
04302   *this = *this - v;
04303   return *this;
04304 }
04305 
04306 inline scmatrix_subv& scmatrix_subv::operator-=(const scvector_slice& v) {
04307   *this = *this - v;
04308   return *this;
04309 }
04310 
04311 inline scmatrix_subv& scmatrix_subv::operator-=(const cvector& v) {
04312   *this = *this - v;
04313   return *this;
04314 }
04315 
04316 inline scmatrix_subv& scmatrix_subv::operator-=(const cvector_slice& v) {
04317   *this = *this - v;
04318   return *this;
04319 }
04320 
04321 inline cmatrix_subv& cmatrix_subv::operator+=(const srmatrix_subv& v) {
04322   *this += rvector(v);
04323   return *this;
04324 }
04325 
04326 inline cmatrix_subv& cmatrix_subv::operator+=(const scmatrix_subv& v) {
04327   *this += cvector(v);
04328   return *this;
04329 }
04330 
04331 inline cmatrix_subv& cmatrix_subv::operator+=(const srvector& v) {
04332   *this += rvector(v);
04333   return *this;
04334 }
04335 
04336 inline cmatrix_subv& cmatrix_subv::operator+=(const scvector& v) {
04337   *this += cvector(v);
04338   return *this;
04339 }
04340 
04341 inline cmatrix_subv& cmatrix_subv::operator+=(const srvector_slice& v) {
04342   *this += rvector(v);
04343   return *this;
04344 }
04345 
04346 inline cmatrix_subv& cmatrix_subv::operator+=(const scvector_slice& v) {
04347   *this += cvector(v);
04348   return *this;
04349 }
04350 
04351 inline cmatrix_subv& cmatrix_subv::operator-=(const srmatrix_subv& v) {
04352   *this -= rvector(v);
04353   return *this;
04354 }
04355 
04356 inline cmatrix_subv& cmatrix_subv::operator-=(const scmatrix_subv& v) {
04357   *this -= cvector(v);
04358   return *this;
04359 }
04360 
04361 inline cmatrix_subv& cmatrix_subv::operator=(const srvector& v) {
04362   *this = rvector(v);
04363   return *this;
04364 }
04365 
04366 inline cmatrix_subv& cmatrix_subv::operator=(const scvector& v) {
04367   *this = cvector(v);
04368   return *this;
04369 }
04370 
04371 inline cmatrix_subv& cmatrix_subv::operator=(const srvector_slice& v) {
04372   *this = rvector(v);
04373   return *this;
04374 }
04375 
04376 inline cmatrix_subv& cmatrix_subv::operator=(const scvector_slice& v) {
04377   *this = cvector(v);
04378   return *this;
04379 }
04380 
04381 inline cmatrix_subv& cmatrix_subv::operator=(const srmatrix_subv& v) {
04382   *this = rvector(v);
04383   return *this;
04384 }
04385 
04386 inline cmatrix_subv& cmatrix_subv::operator=(const scmatrix_subv& v) {
04387   *this = cvector(v);
04388   return *this;
04389 }
04390 
04392 inline bool operator==(const scmatrix_subv& v1, const srvector& v2) {
04393   return scvector(v1) == v2;
04394 }
04395 
04397 inline bool operator==(const srmatrix_subv& v1, const scvector& v2) {
04398   return srvector(v1) == v2;
04399 }
04400 
04402 inline bool operator==(const scmatrix_subv& v1, const scvector& v2) {
04403   return scvector(v1) == v2;
04404 }
04405 
04407 inline bool operator==(const scmatrix_subv& v1, const srvector_slice& v2) {
04408   return scvector(v1) == v2;
04409 }
04410 
04412 inline bool operator==(const srmatrix_subv& v1, const scvector_slice& v2) {
04413   return srvector(v1) == v2;
04414 }
04415 
04417 inline bool operator==(const scmatrix_subv& v1, const scvector_slice& v2) {
04418   return scvector(v1) == v2;
04419 }
04420 
04422 inline bool operator==(const scmatrix_subv& v1, const rvector& v2) {
04423   return scvector(v1) == v2;
04424 }
04425 
04427 inline bool operator==(const srmatrix_subv& v1, const cvector& v2) {
04428   return srvector(v1) == v2;
04429 }
04430 
04432 inline bool operator==(const scmatrix_subv& v1, const cvector& v2) {
04433   return scvector(v1) == v2;
04434 }
04435 
04437 inline bool operator==(const scmatrix_subv& v1, const rvector_slice& v2) {
04438   return scvector(v1) == v2;
04439 }
04440 
04442 inline bool operator==(const srmatrix_subv& v1, const cvector_slice& v2) {
04443   return srvector(v1) == v2;
04444 }
04445 
04447 inline bool operator==(const scmatrix_subv& v1, const cvector_slice& v2) {
04448   return scvector(v1) == v2;
04449 }
04450 
04452 inline bool operator==(const scvector& v1, const srmatrix_subv& v2) {
04453   return v1 == srvector(v2);
04454 }
04455 
04457 inline bool operator==(const srvector& v1, const scmatrix_subv& v2) {
04458   return v1 == scvector(v2);
04459 }
04460 
04462 inline bool operator==(const scvector& v1, const scmatrix_subv& v2) {
04463   return v1 == scvector(v2);
04464 }
04465 
04467 inline bool operator==(const scvector_slice& v1, const srmatrix_subv& v2) {
04468   return v1 == srvector(v2);
04469 }
04470 
04472 inline bool operator==(const srvector_slice& v1, const scmatrix_subv& v2) {
04473   return v1 == scvector(v2);
04474 }
04475 
04477 inline bool operator==(const scvector_slice& v1, const scmatrix_subv& v2) {
04478   return v1 == scvector(v2);
04479 }
04480 
04482 inline bool operator==(const cvector& v1, const srmatrix_subv& v2) {
04483   return v1 == srvector(v2);
04484 }
04485 
04487 inline bool operator==(const rvector& v1, const scmatrix_subv& v2) {
04488   return v1 == scvector(v2);
04489 }
04490 
04492 inline bool operator==(const cvector& v1, const scmatrix_subv& v2) {
04493   return v1 == scvector(v2);
04494 }
04495 
04497 inline bool operator==(const cvector_slice& v1, const srmatrix_subv& v2) {
04498   return v1 == srvector(v2);
04499 }
04500 
04502 inline bool operator==(const rvector_slice& v1, const scmatrix_subv& v2) {
04503   return v1 == scvector(v2);
04504 }
04505 
04507 inline bool operator==(const cvector_slice& v1, const scmatrix_subv& v2) {
04508   return v1 == scvector(v2);
04509 }
04510 
04512 inline bool operator!=(const scmatrix_subv& v1, const srvector& v2) {
04513   return scvector(v1) != v2;
04514 }
04515 
04517 inline bool operator!=(const srmatrix_subv& v1, const scvector& v2) {
04518   return srvector(v1) != v2;
04519 }
04520 
04522 inline bool operator!=(const scmatrix_subv& v1, const scvector& v2) {
04523   return scvector(v1) != v2;
04524 }
04525 
04527 inline bool operator!=(const scmatrix_subv& v1, const srvector_slice& v2) {
04528   return scvector(v1) != v2;
04529 }
04530 
04532 inline bool operator!=(const srmatrix_subv& v1, const scvector_slice& v2) {
04533   return srvector(v1) != v2;
04534 }
04535 
04537 inline bool operator!=(const scmatrix_subv& v1, const scvector_slice& v2) {
04538   return scvector(v1) != v2;
04539 }
04540 
04542 inline bool operator!=(const scmatrix_subv& v1, const rvector& v2) {
04543   return scvector(v1) != v2;
04544 }
04545 
04547 inline bool operator!=(const srmatrix_subv& v1, const cvector& v2) {
04548   return srvector(v1) != v2;
04549 }
04550 
04552 inline bool operator!=(const scmatrix_subv& v1, const cvector& v2) {
04553   return scvector(v1) != v2;
04554 }
04555 
04557 inline bool operator!=(const scmatrix_subv& v1, const rvector_slice& v2) {
04558   return scvector(v1) != v2;
04559 }
04561 
04562 inline bool operator!=(const srmatrix_subv& v1, const cvector_slice& v2) {
04563   return srvector(v1) != v2;
04564 }
04565 
04567 inline bool operator!=(const scmatrix_subv& v1, const cvector_slice& v2) {
04568   return scvector(v1) != v2;
04569 }
04570 
04572 inline bool operator!=(const scvector& v1, const srmatrix_subv& v2) {
04573   return v1 != srvector(v2);
04574 }
04575 
04577 inline bool operator!=(const srvector& v1, const scmatrix_subv& v2) {
04578   return v1 != scvector(v2);
04579 }
04580 
04582 inline bool operator!=(const scvector& v1, const scmatrix_subv& v2) {
04583   return v1 != scvector(v2);
04584 }
04585 
04587 inline bool operator!=(const scvector_slice& v1, const srmatrix_subv& v2) {
04588   return v1 != srvector(v2);
04589 }
04590 
04592 inline bool operator!=(const srvector_slice& v1, const scmatrix_subv& v2) {
04593   return v1 != scvector(v2);
04594 }
04595 
04597 inline bool operator!=(const scvector_slice& v1, const scmatrix_subv& v2) {
04598   return v1 != scvector(v2);
04599 }
04600 
04602 inline bool operator!=(const cvector& v1, const srmatrix_subv& v2) {
04603   return v1 != srvector(v2);
04604 }
04605 
04607 inline bool operator!=(const rvector& v1, const scmatrix_subv& v2) {
04608   return v1 != scvector(v2);
04609 }
04610 
04612 inline bool operator!=(const cvector& v1, const scmatrix_subv& v2) {
04613   return v1 != scvector(v2);
04614 }
04615 
04617 inline bool operator!=(const cvector_slice& v1, const srmatrix_subv& v2) {
04618   return v1 != srvector(v2);
04619 }
04620 
04622 inline bool operator!=(const rvector_slice& v1, const scmatrix_subv& v2) {
04623   return v1 != scvector(v2);
04624 }
04625 
04627 inline bool operator!=(const cvector_slice& v1, const scmatrix_subv& v2) {
04628   return v1 != scvector(v2);
04629 }
04630 
04632 inline bool operator!(const scmatrix_subv& x) {
04633   return sv_v_not(x);
04634 }
04635 
04637 
04640 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const scmatrix_subv& v2) {
04641   spsp_vv_accu<cdotprecision,scvector,scvector,sparse_cdot>(dot, scvector(v1), scvector(v2));
04642 }
04643 
04645 
04648 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const srmatrix_subv& v2) {
04649   spsp_vv_accu<cdotprecision,scvector,srvector,sparse_cdot>(dot, scvector(v1), srvector(v2));
04650 }
04651 
04653 
04656 inline void accumulate(cdotprecision& dot, const srmatrix_subv& v1, const scmatrix_subv& v2) {
04657   spsp_vv_accu<cdotprecision,srvector,scvector,sparse_cdot>(dot, srvector(v1), scvector(v2));
04658 }
04659 
04661 
04664 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const scvector& v2) {
04665   spsp_vv_accu<cdotprecision,scvector,scvector,sparse_cdot>(dot, scvector(v1), v2);
04666 }
04667 
04669 
04672 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const srvector& v2) {
04673   spsp_vv_accu<cdotprecision,scvector,srvector,sparse_cdot>(dot, scvector(v1), v2);
04674 }
04675 
04677 
04680 inline void accumulate(cdotprecision& dot, const srmatrix_subv& v1, const scvector& v2) {
04681   spsp_vv_accu<cdotprecision,srvector,scvector,sparse_cdot>(dot, srvector(v1), v2);
04682 }
04683 
04685 
04688 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const scvector_slice& v2) {
04689   spsl_vv_accu<cdotprecision,scvector,scvector_slice,sparse_cdot>(dot, scvector(v1), v2);
04690 }
04691 
04693 
04696 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const srvector_slice& v2) {
04697   spsl_vv_accu<cdotprecision,scvector,srvector_slice,sparse_cdot>(dot, scvector(v1), v2);
04698 }
04699 
04701 
04704 inline void accumulate(cdotprecision& dot, const srmatrix_subv& v1, const scvector_slice& v2) {
04705   spsl_vv_accu<cdotprecision,srvector,scvector_slice,sparse_cdot>(dot, srvector(v1), v2);
04706 }
04707 
04709 
04712 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const cvector& v2) {
04713   spf_vv_accu<cdotprecision,scvector,cvector,sparse_cdot>(dot, scvector(v1), v2);
04714 }
04715 
04717 
04720 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const rvector& v2) {
04721   spf_vv_accu<cdotprecision,scvector,rvector,sparse_cdot>(dot, scvector(v1), v2);
04722 }
04723 
04725 
04728 inline void accumulate(cdotprecision& dot, const srmatrix_subv& v1, const cvector& v2) {
04729   spf_vv_accu<cdotprecision,srvector,cvector,sparse_cdot>(dot, srvector(v1), v2);
04730 }
04731 
04733 
04736 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const cvector_slice& v2) {
04737   spf_vv_accu<cdotprecision,scvector,cvector_slice,sparse_cdot>(dot, scvector(v1), v2);
04738 }
04739 
04741 
04744 inline void accumulate(cdotprecision& dot, const scmatrix_subv& v1, const rvector_slice& v2) {
04745   spf_vv_accu<cdotprecision,scvector,rvector_slice,sparse_cdot>(dot, scvector(v1), v2);
04746 }
04747 
04749 
04752 inline void accumulate(cdotprecision& dot, const srmatrix_subv& v1, const cvector_slice& v2) {
04753   spf_vv_accu<cdotprecision,srvector,cvector_slice,sparse_cdot>(dot, srvector(v1), v2);
04754 }
04755 
04757 
04760 inline void accumulate(cdotprecision& dot, const scvector& v1, const scmatrix_subv& v2) {
04761   spsp_vv_accu<cdotprecision,scvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
04762 }
04763 
04765 
04768 inline void accumulate(cdotprecision& dot, const scvector& v1, const srmatrix_subv& v2) {
04769   spsp_vv_accu<cdotprecision,scvector,srvector,sparse_cdot>(dot, v1, srvector(v2));
04770 }
04771 
04773 
04776 inline void accumulate(cdotprecision& dot, const srvector& v1, const scmatrix_subv& v2) {
04777   spsp_vv_accu<cdotprecision,srvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
04778 }
04779 
04781 
04784 inline void accumulate(cdotprecision& dot, const scvector_slice& v1, const scmatrix_subv& v2) {
04785   slsp_vv_accu<cdotprecision,scvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
04786 }
04787 
04789 
04792 inline void accumulate(cdotprecision& dot, const scvector_slice& v1, const srmatrix_subv& v2) {
04793   slsp_vv_accu<cdotprecision,scvector_slice,srvector,sparse_cdot>(dot, v1, srvector(v2));
04794 }
04795 
04797 
04800 inline void accumulate(cdotprecision& dot, const srvector_slice& v1, const scmatrix_subv& v2) {
04801   slsp_vv_accu<cdotprecision,srvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
04802 }
04803 
04805 
04808 inline void accumulate(cdotprecision& dot, const cvector& v1, const scmatrix_subv& v2) {
04809   fsp_vv_accu<cdotprecision,cvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
04810 }
04811 
04813 
04816 inline void accumulate(cdotprecision& dot, const cvector& v1, const srmatrix_subv& v2) {
04817   fsp_vv_accu<cdotprecision,cvector,srvector,sparse_cdot>(dot, v1, srvector(v2));
04818 }
04819 
04821 
04824 inline void accumulate(cdotprecision& dot, const rvector& v1, const scmatrix_subv& v2) {
04825   fsp_vv_accu<cdotprecision,rvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
04826 }
04827 
04829 
04832 inline void accumulate(cdotprecision& dot, const cvector_slice& v1, const scmatrix_subv& v2) {
04833   fsp_vv_accu<cdotprecision,cvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
04834 }
04835 
04837 
04840 inline void accumulate(cdotprecision& dot, const cvector_slice& v1, const srmatrix_subv& v2) {
04841   fsp_vv_accu<cdotprecision,cvector_slice,srvector,sparse_cdot>(dot, v1, srvector(v2));
04842 }
04843 
04845 
04848 inline void accumulate(cdotprecision& dot, const rvector_slice& v1, const scmatrix_subv& v2) {
04849   fsp_vv_accu<cdotprecision,rvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
04850 }
04851 
04853 
04858 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const scmatrix_subv& v2) {
04859   spsp_vv_accuapprox<cdotprecision,scvector,scvector,sparse_cdot>(dot, scvector(v1), scvector(v2));
04860 }
04861 
04863 
04868 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const srmatrix_subv& v2) {
04869   spsp_vv_accuapprox<cdotprecision,scvector,srvector,sparse_cdot>(dot, scvector(v1), srvector(v2));
04870 }
04871 
04873 
04878 inline void accumulate_approx(cdotprecision& dot, const srmatrix_subv& v1, const scmatrix_subv& v2) {
04879   spsp_vv_accuapprox<cdotprecision,srvector,scvector,sparse_cdot>(dot, srvector(v1), scvector(v2));
04880 }
04881 
04883 
04888 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const scvector& v2) {
04889   spsp_vv_accuapprox<cdotprecision,scvector,scvector,sparse_cdot>(dot, scvector(v1), v2);
04890 }
04891 
04893 
04898 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const srvector& v2) {
04899   spsp_vv_accuapprox<cdotprecision,scvector,srvector,sparse_cdot>(dot, scvector(v1), v2);
04900 }
04901 
04903 
04908 inline void accumulate_approx(cdotprecision& dot, const srmatrix_subv& v1, const scvector& v2) {
04909   spsp_vv_accuapprox<cdotprecision,srvector,scvector,sparse_cdot>(dot, srvector(v1), v2);
04910 }
04911 
04913 
04918 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const scvector_slice& v2) {
04919   spsl_vv_accuapprox<cdotprecision,scvector,scvector_slice,sparse_cdot>(dot, scvector(v1), v2);
04920 }
04921 
04923 
04928 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const srvector_slice& v2) {
04929   spsl_vv_accuapprox<cdotprecision,scvector,srvector_slice,sparse_cdot>(dot, scvector(v1), v2);
04930 }
04931 
04933 
04938 inline void accumulate_approx(cdotprecision& dot, const srmatrix_subv& v1, const scvector_slice& v2) {
04939   spsl_vv_accuapprox<cdotprecision,srvector,scvector_slice,sparse_cdot>(dot, srvector(v1), v2);
04940 }
04941 
04943 
04948 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const cvector& v2) {
04949   spf_vv_accuapprox<cdotprecision,scvector,cvector,sparse_cdot>(dot, scvector(v1), v2);
04950 }
04951 
04953 
04958 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const rvector& v2) {
04959   spf_vv_accuapprox<cdotprecision,scvector,rvector,sparse_cdot>(dot, scvector(v1), v2);
04960 }
04961 
04963 
04968 inline void accumulate_approx(cdotprecision& dot, const srmatrix_subv& v1, const cvector& v2) {
04969   spf_vv_accuapprox<cdotprecision,srvector,cvector,sparse_cdot>(dot, srvector(v1), v2);
04970 }
04971 
04973 
04978 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const cvector_slice& v2) {
04979   spf_vv_accuapprox<cdotprecision,scvector,cvector_slice,sparse_cdot>(dot, scvector(v1), v2);
04980 }
04981 
04983 
04988 inline void accumulate_approx(cdotprecision& dot, const scmatrix_subv& v1, const rvector_slice& v2) {
04989   spf_vv_accuapprox<cdotprecision,scvector,rvector_slice,sparse_cdot>(dot, scvector(v1), v2);
04990 }
04991 
04993 
04998 inline void accumulate_approx(cdotprecision& dot, const srmatrix_subv& v1, const cvector_slice& v2) {
04999   spf_vv_accuapprox<cdotprecision,srvector,cvector_slice,sparse_cdot>(dot, srvector(v1), v2);
05000 }
05001 
05003 
05008 inline void accumulate_approx(cdotprecision& dot, const scvector& v1, const scmatrix_subv& v2) {
05009   spsp_vv_accuapprox<cdotprecision,scvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
05010 }
05011 
05013 
05018 inline void accumulate_approx(cdotprecision& dot, const scvector& v1, const srmatrix_subv& v2) {
05019   spsp_vv_accuapprox<cdotprecision,scvector,srvector,sparse_cdot>(dot, v1, srvector(v2));
05020 }
05021 
05023 
05028 inline void accumulate_approx(cdotprecision& dot, const srvector& v1, const scmatrix_subv& v2) {
05029   spsp_vv_accuapprox<cdotprecision,srvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
05030 }
05031 
05033 
05038 inline void accumulate_approx(cdotprecision& dot, const scvector_slice& v1, const scmatrix_subv& v2) {
05039   slsp_vv_accuapprox<cdotprecision,scvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
05040 }
05041 
05043 
05048 inline void accumulate_approx(cdotprecision& dot, const scvector_slice& v1, const srmatrix_subv& v2) {
05049   slsp_vv_accuapprox<cdotprecision,scvector_slice,srvector,sparse_cdot>(dot, v1, srvector(v2));
05050 }
05051 
05053 
05058 inline void accumulate_approx(cdotprecision& dot, const srvector_slice& v1, const scmatrix_subv& v2) {
05059   slsp_vv_accuapprox<cdotprecision,srvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
05060 }
05061 
05063 
05068 inline void accumulate_approx(cdotprecision& dot, const cvector& v1, const scmatrix_subv& v2) {
05069   fsp_vv_accuapprox<cdotprecision,cvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
05070 }
05071 
05073 
05078 inline void accumulate_approx(cdotprecision& dot, const cvector& v1, const srmatrix_subv& v2) {
05079   fsp_vv_accuapprox<cdotprecision,cvector,srvector,sparse_cdot>(dot, v1, srvector(v2));
05080 }
05081 
05083 
05088 inline void accumulate_approx(cdotprecision& dot, const rvector& v1, const scmatrix_subv& v2) {
05089   fsp_vv_accuapprox<cdotprecision,rvector,scvector,sparse_cdot>(dot, v1, scvector(v2));
05090 }
05091 
05093 
05098 inline void accumulate_approx(cdotprecision& dot, const cvector_slice& v1, const scmatrix_subv& v2) {
05099   fsp_vv_accuapprox<cdotprecision,cvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
05100 }
05101 
05103 
05108 inline void accumulate_approx(cdotprecision& dot, const cvector_slice& v1, const srmatrix_subv& v2) {
05109   fsp_vv_accuapprox<cdotprecision,cvector_slice,srvector,sparse_cdot>(dot, v1, srvector(v2));
05110 }
05111 
05113 
05118 inline void accumulate_approx(cdotprecision& dot, const rvector_slice& v1, const scmatrix_subv& v2) {
05119   fsp_vv_accuapprox<cdotprecision,rvector_slice,scvector,sparse_cdot>(dot, v1, scvector(v2));
05120 }
05121 
05123 
05126 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const scmatrix_subv& v2) {
05127   cdotprecision tmp(0.0);
05128   tmp.set_k(dot.get_k());
05129   accumulate(tmp,scvector(v1),scvector(v2));
05130   dot += tmp;
05131 }
05132 
05134 
05137 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const srmatrix_subv& v2) {
05138   cdotprecision tmp(0.0);
05139   tmp.set_k(dot.get_k());
05140   accumulate(tmp,scvector(v1),srvector(v2));
05141   dot += tmp;
05142 }
05143 
05145 
05148 inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const scmatrix_subv& v2) {
05149   cdotprecision tmp(0.0);
05150   tmp.set_k(dot.get_k());
05151   accumulate(tmp,srvector(v1),scvector(v2));
05152   dot += tmp;
05153 }
05154 
05156 
05159 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const scvector& v2) {
05160   cdotprecision tmp(0.0);
05161   tmp.set_k(dot.get_k());
05162   accumulate(tmp,scvector(v1),v2);
05163   dot += tmp;
05164 }
05165 
05167 
05170 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const srvector& v2) {
05171   cdotprecision tmp(0.0);
05172   tmp.set_k(dot.get_k());
05173   accumulate(tmp,scvector(v1),v2);
05174   dot += tmp;
05175 }
05176 
05178 
05181 inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const scvector& v2) {
05182   cdotprecision tmp(0.0);
05183   tmp.set_k(dot.get_k());
05184   accumulate(tmp,srvector(v1),v2);
05185   dot += tmp;
05186 }
05187 
05189 
05192 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const scvector_slice& v2) {
05193   cdotprecision tmp(0.0);
05194   tmp.set_k(dot.get_k());
05195   accumulate(tmp,scvector(v1),v2);
05196   dot += tmp;
05197 }
05198 
05200 
05203 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const srvector_slice& v2) {
05204   cdotprecision tmp(0.0);
05205   tmp.set_k(dot.get_k());
05206   accumulate(tmp,scvector(v1),v2);
05207   dot += tmp;
05208 }
05209 
05211 
05214 inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const scvector_slice& v2) {
05215   cdotprecision tmp(0.0);
05216   tmp.set_k(dot.get_k());
05217   accumulate(tmp,srvector(v1),v2);
05218   dot += tmp;
05219 }
05220 
05222 
05225 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const cvector& v2) {
05226   cdotprecision tmp(0.0);
05227   tmp.set_k(dot.get_k());
05228   accumulate(tmp,scvector(v1),v2);
05229   dot += tmp;
05230 }
05231 
05233 
05236 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const rvector& v2) {
05237   cdotprecision tmp(0.0);
05238   tmp.set_k(dot.get_k());
05239   accumulate(tmp,scvector(v1),v2);
05240   dot += tmp;
05241 }
05242 
05244 
05247 inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const cvector& v2) {
05248   cdotprecision tmp(0.0);
05249   tmp.set_k(dot.get_k());
05250   accumulate(tmp,srvector(v1),v2);
05251   dot += tmp;
05252 }
05253 
05255 
05258 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const cvector_slice& v2) {
05259   cdotprecision tmp(0.0);
05260   tmp.set_k(dot.get_k());
05261   accumulate(tmp,scvector(v1),v2);
05262   dot += tmp;
05263 }
05264 
05266 
05269 inline void accumulate(cidotprecision& dot, const scmatrix_subv& v1, const rvector_slice& v2) {
05270   cdotprecision tmp(0.0);
05271   tmp.set_k(dot.get_k());
05272   accumulate(tmp,scvector(v1),v2);
05273   dot += tmp;
05274 }
05275 
05277 
05280 inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const cvector_slice& v2) {
05281   cdotprecision tmp(0.0);
05282   tmp.set_k(dot.get_k());
05283   accumulate(tmp,srvector(v1),v2);
05284   dot += tmp;
05285 }
05286 
05288 
05291 inline void accumulate(cidotprecision& dot, const scvector& v1, const scmatrix_subv& v2) {
05292   cdotprecision tmp(0.0);
05293   tmp.set_k(dot.get_k());
05294   accumulate(tmp,v1,scvector(v2));
05295   dot += tmp;
05296 }
05297 
05299 
05302 inline void accumulate(cidotprecision& dot, const scvector& v1, const srmatrix_subv& v2) {
05303   cdotprecision tmp(0.0);
05304   tmp.set_k(dot.get_k());
05305   accumulate(tmp,v1,srvector(v2));
05306   dot += tmp;
05307 }
05308 
05310 
05313 inline void accumulate(cidotprecision& dot, const srvector& v1, const scmatrix_subv& v2) {
05314   cdotprecision tmp(0.0);
05315   tmp.set_k(dot.get_k());
05316   accumulate(tmp,v1,scvector(v2));
05317   dot += tmp;
05318 }
05319 
05321 
05324 inline void accumulate(cidotprecision& dot, const scvector_slice& v1, const scmatrix_subv& v2) {
05325   cdotprecision tmp(0.0);
05326   tmp.set_k(dot.get_k());
05327   accumulate(tmp,v1,scvector(v2));
05328   dot += tmp;
05329 }
05330 
05332 
05335 inline void accumulate(cidotprecision& dot, const scvector_slice& v1, const srmatrix_subv& v2) {
05336   cdotprecision tmp(0.0);
05337   tmp.set_k(dot.get_k());
05338   accumulate(tmp,v1,srvector(v2));
05339   dot += tmp;
05340 }
05341 
05343 
05346 inline void accumulate(cidotprecision& dot, const srvector_slice& v1, const scmatrix_subv& v2) {
05347   cdotprecision tmp(0.0);
05348   tmp.set_k(dot.get_k());
05349   accumulate(tmp,v1,scvector(v2));
05350   dot += tmp;
05351 }
05352 
05354 
05357 inline void accumulate(cidotprecision& dot, const cvector& v1, const scmatrix_subv& v2) {
05358   cdotprecision tmp(0.0);
05359   tmp.set_k(dot.get_k());
05360   accumulate(tmp,v1,scvector(v2));
05361   dot += tmp;
05362 }
05363 
05365 
05368 inline void accumulate(cidotprecision& dot, const cvector& v1, const srmatrix_subv& v2) {
05369   cdotprecision tmp(0.0);
05370   tmp.set_k(dot.get_k());
05371   accumulate(tmp,v1,srvector(v2));
05372   dot += tmp;
05373 }
05374 
05376 
05379 inline void accumulate(cidotprecision& dot, const rvector& v1, const scmatrix_subv& v2) {
05380   cdotprecision tmp(0.0);
05381   tmp.set_k(dot.get_k());
05382   accumulate(tmp,v1,scvector(v2));
05383   dot += tmp;
05384 }
05385 
05387 
05390 inline void accumulate(cidotprecision& dot, const cvector_slice& v1, const scmatrix_subv& v2) {
05391   cdotprecision tmp(0.0);
05392   tmp.set_k(dot.get_k());
05393   accumulate(tmp,v1,scvector(v2));
05394   dot += tmp;
05395 }
05396 
05398 
05401 inline void accumulate(cidotprecision& dot, const cvector_slice& v1, const srmatrix_subv& v2) {
05402   cdotprecision tmp(0.0);
05403   tmp.set_k(dot.get_k());
05404   accumulate(tmp,v1,srvector(v2));
05405   dot += tmp;
05406 }
05407 
05409 
05412 inline void accumulate(cidotprecision& dot, const rvector_slice& v1, const scmatrix_subv& v2) {
05413   cdotprecision tmp(0.0);
05414   tmp.set_k(dot.get_k());
05415   accumulate(tmp,v1,scvector(v2));
05416   dot += tmp;
05417 }
05418 
05419 }  //namespace cxsc;
05420 
05421 #include "sparsematrix.inl"
05422 
05423 #endif 
05424