C-XSC - A C++ Class Library for Extended Scientific Computing 2.5.4
simatrix.hpp
1/*
2** CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4)
3**
4** Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
5** Universitaet Karlsruhe, Germany
6** (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie
7** Universitaet Wuppertal, Germany
8**
9** This library is free software; you can redistribute it and/or
10** modify it under the terms of the GNU Library General Public
11** License as published by the Free Software Foundation; either
12** version 2 of the License, or (at your option) any later version.
13**
14** This library is distributed in the hope that it will be useful,
15** but WITHOUT ANY WARRANTY; without even the implied warranty of
16** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17** Library General Public License for more details.
18**
19** You should have received a copy of the GNU Library General Public
20** License along with this library; if not, write to the Free
21** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*/
23
24/* CVS $Id: simatrix.hpp,v 1.20 2014/01/30 17:23:48 cxsc Exp $ */
25
26#ifndef _CXSC_SIMATRIX_HPP_INCLUDED
27#define _CXSC_SIMATRIX_HPP_INCLUDED
28
29#include <interval.hpp>
30#include <imatrix.hpp>
31#include <ivector.hpp>
32#include <sivector.hpp>
33#include <vector>
34#include <algorithm>
35#include <iostream>
36#include <cidot.hpp>
37#include <sparseidot.hpp>
38#include <sparsematrix.hpp>
39#include <srmatrix.hpp>
40
41namespace cxsc {
42
43//definiert in srmatrix.hpp
44//enum STORAGE_TYPE{triplet,compressed_row,compressed_column};
45
46class simatrix_slice;
47class simatrix_subv;
48class scimatrix;
49class scimatrix_slice;
50class scimatrix_subv;
51
52inline bool comp_pair_i(std::pair<int,interval> p1, std::pair<int,interval> p2) {
53 return p1.first < p2.first;
54}
55
57
69class simatrix {
70
71 private:
72 std::vector<int> p;
73 std::vector<int> ind;
74 std::vector<interval> x;
75 int m;
76 int n;
77 int lb1,ub1,lb2,ub2;
78
79 public:
80
82 std::vector<int>& column_pointers() {
83 return p;
84 }
85
87 std::vector<int>& row_indices() {
88 return ind;
89 }
90
92 std::vector<interval>& values() {
93 return x;
94 }
95
97 const std::vector<int>& column_pointers() const {
98 return p;
99 }
100
102 const std::vector<int>& row_indices() const {
103 return ind;
104 }
105
107 const std::vector<interval>& values() const {
108 return x;
109 }
110
113 p.push_back(0);
114 m = n = 0;
115 lb1 = lb2 = ub1 = ub2 = 0;
116 }
117
119 simatrix(const int r, const int c) : m(r),n(c),lb1(1),ub1(r),lb2(1),ub2(c) {
120 p = std::vector<int>((n>0) ? n+1 : 1, 0);
121 ind.reserve(2*(m+n));
122 x.reserve(2*(m+n));
123
124 p[0] = 0;
125 }
126
128 simatrix(const int r, const int c, const int e) : m(r),n(c),lb1(1),ub1(r),lb2(1),ub2(c) {
129 p = std::vector<int>((n>0) ? n+1 : 1, 0);
130 ind.reserve(e);
131 x.reserve(e);
132
133 p[0] = 0;
134 }
135
137
143 simatrix(const int m, const int n, const int nnz, const intvector& rows, const intvector& cols, const ivector& values, const enum STORAGE_TYPE t = triplet) {
144 if(t == triplet) {
145 this->m = m;
146 this->n = n;
147 p = std::vector<int>(n+1,0);
148 ind.reserve(nnz);
149 x.reserve(nnz);
150 lb1 = lb2 = 1;
151 ub1 = m; ub2 = n;
152
153 std::vector<triplet_store<interval> > work;
154 work.reserve(nnz);
155
156 for(int k=0 ; k<nnz ; k++) {
157 work.push_back(triplet_store<interval>(rows[Lb(rows)+k],cols[Lb(cols)+k],values[Lb(values)+k]));
158 }
159
160 sort(work.begin(), work.end());
161
162 int i=0;
163
164 for(int j=0 ; j<n ; j++) {
165
166 while((unsigned int)i < work.size() && work[i].col == j ) {
167 ind.push_back(work[i].row);
168 x.push_back(work[i].val);
169 i++;
170 }
171
172 p[j+1] = i;
173 }
174
175 } else if(t == compressed_row) {
176
177 this->m = m;
178 this->n = n;
179 p = std::vector<int>(n+1,0);
180 ind.reserve(nnz);
181 x.reserve(nnz);
182 lb1 = lb2 = 1;
183 ub1 = m; ub2 = n;
184
185 for(int i=0 ; i<n+1 ; i++)
186 p[i] = rows[Lb(rows)+i];
187
188 std::vector<triplet_store<interval> > work;
189 work.reserve(nnz);
190
191 for(int j=0 ; j<n ; j++) {
192 for(int k=p[j] ; k<p[j+1] ; k++) {
193 work.push_back(triplet_store<interval>(j,cols[Lb(cols)+k],values[Lb(values)+k]));
194 }
195 }
196
197 sort(work.begin(), work.end());
198
199 int i=0;
200
201 for(int j=0 ; j<n ; j++) {
202
203 while((unsigned int)i < work.size() && work[i].col == j ) {
204 ind.push_back(work[i].row);
205 x.push_back(work[i].val);
206 i++;
207 }
208
209 p[j+1] = i;
210 }
211
212 } else if(t == compressed_column) {
213 this->m = m;
214 this->n = n;
215 p = std::vector<int>(n+1,0);
216 ind.reserve(nnz);
217 x.reserve(nnz);
218 lb1 = lb2 = 1;
219 ub1 = m; ub2 = n;
220
221 for(int i=0 ; i<n+1 ; i++)
222 p[i] = rows[Lb(rows)+i];
223
224 std::vector<std::pair<int,interval> > work;
225 work.reserve(n);
226
227 for(int j=0 ; j<n ; j++) {
228 work.clear();
229
230 for(int k=p[j] ; k<p[j+1] ; k++) {
231 work.push_back(std::make_pair(cols[Lb(cols)+k],values[Lb(values)+k]));
232 }
233
234 std::sort(work.begin(),work.end(),comp_pair_i);
235
236 for(unsigned int i=0 ; i<work.size() ; i++) {
237 ind.push_back(work[i].first);
238 x.push_back(work[i].second);
239 }
240 }
241
242 }
243
244 }
245
247
254 simatrix(const int m, const int n, const int nnz, const int* rows, const int* cols, const interval* values, const enum STORAGE_TYPE t = triplet) {
255 if(t == triplet) {
256 this->m = m;
257 this->n = n;
258 p = std::vector<int>(n+1,0);
259 ind.reserve(nnz);
260 x.reserve(nnz);
261 lb1 = lb2 = 1;
262 ub1 = m; ub2 = n;
263
264 std::vector<triplet_store<interval> > work;
265 work.reserve(nnz);
266
267 for(int k=0 ; k<nnz ; k++) {
268 work.push_back(triplet_store<interval>(rows[k],cols[k],values[k]));
269 }
270
271 sort(work.begin(), work.end());
272
273 int i=0;
274
275 for(int j=0 ; j<n ; j++) {
276
277 while((unsigned int)i < work.size() && work[i].col == j ) {
278 ind.push_back(work[i].row);
279 x.push_back(work[i].val);
280 i++;
281 }
282
283 p[j+1] = i;
284 }
285
286 } else if(t == compressed_row) {
287
288 this->m = m;
289 this->n = n;
290 p = std::vector<int>(n+1,0);
291 ind.reserve(nnz);
292 x.reserve(nnz);
293 lb1 = lb2 = 1;
294 ub1 = m; ub2 = n;
295
296 for(int i=0 ; i<n+1 ; i++)
297 p[i] = rows[i];
298
299 std::vector<triplet_store<interval> > work;
300 work.reserve(nnz);
301
302 for(int j=0 ; j<n ; j++) {
303 for(int k=p[j] ; k<p[j+1] ; k++) {
304 work.push_back(triplet_store<interval>(j,cols[k],values[k]));
305 }
306 }
307
308 sort(work.begin(), work.end());
309
310 int i=0;
311
312 for(int j=0 ; j<n ; j++) {
313
314 while((unsigned int)i < work.size() && work[i].col == j ) {
315 ind.push_back(work[i].row);
316 x.push_back(work[i].val);
317 i++;
318 }
319
320 p[j+1] = i;
321 }
322
323 } else if(t == compressed_column) {
324 this->m = m;
325 this->n = n;
326 p = std::vector<int>(n+1,0);
327 ind.reserve(nnz);
328 x.reserve(nnz);
329 lb1 = lb2 = 1;
330 ub1 = m; ub2 = n;
331
332 for(int i=0 ; i<n+1 ; i++)
333 p[i] = rows[i];
334
335 std::vector<std::pair<int,interval> > work;
336 work.reserve(n);
337
338 for(int j=0 ; j<n ; j++) {
339 work.clear();
340
341 for(int k=p[j] ; k<p[j+1] ; k++) {
342 work.push_back(std::make_pair(cols[k],values[k]));
343 }
344
345 std::sort(work.begin(),work.end(),comp_pair_i);
346
347 for(unsigned int i=0 ; i<work.size() ; i++) {
348 ind.push_back(work[i].first);
349 x.push_back(work[i].second);
350 }
351 }
352
353 }
354
355 }
356
357
359 simatrix(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) {
360 x.reserve(A.get_nnz());
361 for(unsigned int i=0 ; i<A.x.size() ; i++)
362 x.push_back(interval(A.x[i]));
363 }
364
365
367 simatrix(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)) {
368 p = std::vector<int>((n>0) ? n+1 : 1, 0);
369 ind.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
370 x.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
371
372 p[0] = 0;
373 int nnz = 0;
374
375 for(int j=0 ; j<n ; j++) {
376 for(int i=0 ; i<m ; i++) {
377 if(A[i+lb1][j+lb2] != 0.0) {
378 ind.push_back(i);
379 x.push_back(interval(A[i+lb1][j+lb2]));
380 nnz++;
381 }
382 }
383
384 p[j+1] = nnz;
385 }
386
387 }
388
390 simatrix(const imatrix& A) : m(ColLen(A)),n(RowLen(A)),lb1(Lb(A,1)),ub1(Ub(A,1)),lb2(Lb(A,2)),ub2(Ub(A,2)) {
391 p = std::vector<int>((n>0) ? n+1 : 1, 0);
392 ind.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
393 x.reserve((m*n*0.1 < 2*m) ? (int)(m*n*0.1) : 2*m);
394
395 p[0] = 0;
396 int nnz = 0;
397
398 for(int j=0 ; j<n ; j++) {
399 for(int i=0 ; i<m ; i++) {
400 if(A[i+lb1][j+lb2] != 0.0) {
401 ind.push_back(i);
402 x.push_back(interval(A[i+lb1][j+lb2]));
403 nnz++;
404 }
405 }
406
407 p[j+1] = nnz;
408 }
409
410 }
411
413
416 simatrix(const int ms, const int ns, const imatrix& A) : m(ms), n(ns), lb1(1), ub1(ms), lb2(1), ub2(ns) {
417 //Banded matrix constructor
418 int nnz = RowLen(A)*ColLen(A);
419 p = std::vector<int>((n>0) ? n+1 : 1, 0);
420 ind.reserve(nnz);
421 x.reserve(nnz);
422
423 std::vector<triplet_store<interval> > work;
424 work.reserve(nnz);
425
426
427 for(int i=0 ; i<ColLen(A) ; i++) {
428 for(int j=Lb(A,2) ; j<=Ub(A,2) ; j++) {
429 if(i+j >=0 && i+j < n) {
430 work.push_back(triplet_store<interval>(i,i+j,A[i+Lb(A,1)][j]));
431 }
432 }
433 }
434
435 sort(work.begin(), work.end());
436
437 int i=0;
438
439 for(int j=0 ; j<n ; j++) {
440
441 while((unsigned int)i < work.size() && work[i].col == j ) {
442 ind.push_back(work[i].row);
443 x.push_back(work[i].val);
444 i++;
445 }
446
447 p[j+1] = i;
448 }
449
450 }
451
453 simatrix(const srmatrix_slice&);
455 simatrix(const simatrix_slice&);
456
458 void full(imatrix& A) const {
459 A = imatrix(lb1,ub1,lb2,ub2);
460 A = 0.0;
461 for(int j=0 ; j<n ; j++) {
462 for(int k=p[j] ; k<p[j+1] ; k++) {
463 A[ind[k]+lb1][j+lb2] = x[k];
464 }
465 }
466 }
467
469
473 void dropzeros() {
474 std::vector<int> pnew(n+1,0);
475 std::vector<int> indnew;
476 std::vector<interval> xnew;
477 int nnznew = 0;
478
479 for(int j=0 ; j<n ; j++) {
480 for(int k=p[j] ; k<p[j+1] ; k++) {
481 if(x[k] != 0.0) {
482 xnew.push_back(x[k]);
483 indnew.push_back(ind[k]);
484 nnznew++;
485 }
486 }
487 pnew[j+1] = nnznew;
488 }
489
490 p = pnew;
491 ind = indnew;
492 x = xnew;
493 }
494
495
498 return sp_ms_assign<simatrix,real,interval>(*this,A);
499 }
500
503 return sp_ms_assign<simatrix,interval,interval>(*this,A);
504 }
505
508 return spf_mm_assign<simatrix,rmatrix,interval>(*this,A);
509 }
510
513 return spf_mm_assign<simatrix,imatrix,interval>(*this,A);
514 }
515
518 return spf_mm_assign<simatrix,rmatrix_slice,interval>(*this,A);
519 }
520
523 return spf_mm_assign<simatrix,imatrix_slice,interval>(*this,A);
524 }
525
528 m = A.m;
529 n = A.n;
530 p = A.p;
531 ind = A.ind;
532 x.clear();
533 x.reserve(A.get_nnz());
534 for(unsigned int i=0 ; i<A.x.size() ; i++)
535 x.push_back(interval(A.x[i]));
536 return *this;
537 }
538
539 /* simatrix& operator=(const simatrix& A) {
540 p = A.p;
541 ind = A.ind;
542 x = A.x;
543 return *this;
544 } */
545
550
552
558 const interval operator()(int i, int j) const {
559#if(CXSC_INDEX_CHECK)
560 if(i<lb1 || i>ub1 || j<lb2 || j>ub2)
561 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator()(int, int)"));
562#endif
563 interval r(0.0);
564 for(int k=p[j-lb2] ; k<p[j-lb2+1] && ind[k]<=i-lb1 ; k++) {
565 if(ind[k] == i-lb1) r = x[k];
566 }
567 return r;
568 }
569
571
579 interval& element(int i, int j) {
580#if(CXSC_INDEX_CHECK)
581 if(i<lb1 || i>ub1 || j<lb2 || j>ub2)
582 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator()(int, int)"));
583#endif
584 int k;
585 for(k=p[j-lb2] ; k<p[j-lb2+1] && ind[k]<=i-lb1 ; k++) {
586 if(ind[k] == i-lb1) return x[k];
587 }
588
589 //Nicht gefunden, Element muss angelegt werden, da Schreibzugriff moeglich
590 std::vector<int>::iterator ind_it = ind.begin() + k;
591 std::vector<interval>::iterator x_it = x.begin() + k;
592 ind.insert(ind_it, i-lb1);
593 x_it = x.insert(x_it, interval(0.0));
594 for(k=j-lb2+1 ; k<(int)p.size() ; k++)
595 p[k]++;
596
597 return *x_it;
598 }
599
601 simatrix_subv operator[](const cxscmatrix_column&);
603 simatrix_subv operator[](const int);
605 const simatrix_subv operator[](const cxscmatrix_column&) const;
607 const simatrix_subv operator[](const int) const;
608
610 simatrix_slice operator()(const int, const int , const int, const int);
612 const simatrix_slice operator()(const int, const int , const int, const int) const;
613
615 simatrix operator()(const intvector& pervec, const intvector& q) {
616 simatrix A(m,n,get_nnz());
617 intvector per = perminv(pervec);
618
619 int nnz=0;
620 for(int k=0 ; k<n ; k++) {
621 A.p[k] = nnz;
622
623 std::map<int,interval> work;
624 for(int j=p[q[Lb(q)+k]] ; j<p[q[Lb(q)+k]+1] ; j++)
625 work.insert(std::make_pair(per[Lb(per)+ind[j]], x[j]));
626
627 for(std::map<int,interval>::iterator it = work.begin() ; it != work.end() ; it++) {
628 A.ind.push_back(it->first);
629 A.x.push_back(it->second);
630 }
631
632 nnz += work.size();
633
634 }
635
636 A.p[n] = nnz;
637
638 return A;
639 }
640
643 simatrix A(m,n,get_nnz());
644 intvector per = perminv(pervec);
645
646 for(int k=0 ; k<n ; k++) {
647 A.p[k] = p[k];
648
649 std::map<int,interval> work;
650 for(int j=p[k] ; j<p[k+1] ; j++)
651 work.insert(std::make_pair(per[Lb(per)+ind[j]], x[j]));
652
653 for(std::map<int,interval>::iterator it = work.begin() ; it != work.end() ; it++) {
654 A.ind.push_back(it->first);
655 A.x.push_back(it->second);
656 }
657
658 }
659
660 A.p[n] = p[n];
661
662 return A;
663 }
664
667 intvector p = permvec(P);
668 intvector q = perminv(permvec(Q));
669 return (*this)(p,q);
670 }
671
674 intvector p = permvec(P);
675 return (*this)(p);
676 }
677
679 real density() const {
680 return p[n]/((double)m*n);
681 }
682
684 int get_nnz() const {
685 return p[n];
686 }
687
690 return spf_mm_addassign<simatrix,rmatrix,imatrix>(*this,B);
691 }
692
695 return spf_mm_addassign<simatrix,imatrix,imatrix>(*this,B);
696 }
697
700 return spf_mm_addassign<simatrix,rmatrix_slice,imatrix>(*this,B);
701 }
702
705 return spf_mm_addassign<simatrix,imatrix_slice,imatrix>(*this,B);
706 }
707
710 return spsp_mm_addassign<simatrix,srmatrix,interval>(*this,B);
711 }
712
715 return spsp_mm_addassign<simatrix,simatrix,interval>(*this,B);
716 }
717
720 return spf_mm_subassign<simatrix,rmatrix,imatrix>(*this,B);
721 }
722
725 return spf_mm_subassign<simatrix,imatrix,imatrix>(*this,B);
726 }
727
730 return spf_mm_subassign<simatrix,rmatrix_slice,imatrix>(*this,B);
731 }
732
735 return spf_mm_subassign<simatrix,imatrix_slice,imatrix>(*this,B);
736 }
737
740 return spsp_mm_subassign<simatrix,srmatrix,interval>(*this,B);
741 }
742
745 return spsp_mm_subassign<simatrix,simatrix,interval>(*this,B);
746 }
747
750 return spf_mm_multassign<simatrix,imatrix,sparse_idot,imatrix>(*this,B);
751 }
752
755 return spf_mm_multassign<simatrix,rmatrix,sparse_idot,imatrix>(*this,B);
756 }
757
760 return spf_mm_multassign<simatrix,rmatrix_slice,sparse_idot,imatrix>(*this,B);
761 }
762
765 return spf_mm_multassign<simatrix,imatrix_slice,sparse_idot,imatrix>(*this,B);
766 }
767
770 return spsp_mm_multassign<simatrix,srmatrix,sparse_idot,interval>(*this,B);
771 }
772
775 return spsp_mm_multassign<simatrix,simatrix,sparse_idot,interval>(*this,B);
776 }
777
780 return sp_ms_multassign(*this,r);
781 }
782
785 return sp_ms_multassign(*this,r);
786 }
787
790 return sp_ms_divassign(*this,r);
791 }
792
795 return sp_ms_divassign(*this,r);
796 }
797
800 return spf_mm_hullassign<simatrix,rmatrix,imatrix>(*this,B);
801 }
802
805 return spf_mm_hullassign<simatrix,imatrix,imatrix>(*this,B);
806 }
807
810 return spf_mm_hullassign<simatrix,rmatrix_slice,imatrix>(*this,B);
811 }
812
815 return spf_mm_hullassign<simatrix,imatrix_slice,imatrix>(*this,B);
816 }
817
820 return spsp_mm_hullassign<simatrix,srmatrix,interval>(*this,B);
821 }
822
825 return spsp_mm_hullassign<simatrix,simatrix,interval>(*this,B);
826 }
827
830 return spf_mm_intersectassign<simatrix,imatrix,imatrix>(*this,B);
831 }
832
835 return spf_mm_intersectassign<simatrix,imatrix_slice,imatrix>(*this,B);
836 }
837
840 return spsp_mm_intersectassign<simatrix,simatrix,interval>(*this,B);
841 }
842
843 friend void SetLb(simatrix&, const int, const int);
844 friend void SetUb(simatrix&, const int, const int);
845 friend int Lb(const simatrix&, int);
846 friend int Ub(const simatrix&, int);
847 friend int RowLen(const simatrix&);
848 friend int ColLen(const simatrix&);
849 friend srmatrix Inf(const simatrix&);
850 friend srmatrix Sup(const simatrix&);
851 friend simatrix Re(const scimatrix&);
852 friend simatrix Im(const scimatrix&);
853 friend simatrix abs(const simatrix&);
854 friend srmatrix mid(const simatrix&);
855 friend srmatrix diam(const simatrix&);
856 friend simatrix abs(const scimatrix&);
857 friend srmatrix absmin(const simatrix&);
858 friend srmatrix absmax(const simatrix&);
859
860 friend simatrix transp(const simatrix&);
861 friend simatrix Id(const simatrix&);
862 friend srmatrix CompMat(const simatrix&);
863
864 friend std::istream& operator>>(std::istream&, simatrix_slice&);
865 friend std::istream& operator>>(std::istream&, simatrix_subv&);
866
867 friend class srmatrix_slice;
868 friend class srmatrix_subv;
869 friend class srvector;
870 friend class simatrix_slice;
871 friend class simatrix_subv;
872 friend class sivector;
873 friend class scimatrix;
874 friend class scimatrix_slice;
875 friend class scimatrix_subv;
876 friend class scivector;
877 friend class rmatrix;
878 friend class imatrix;
879 friend class cimatrix;
880
881#include "matrix_friend_declarations.inl"
882};
883
884inline imatrix::imatrix(const srmatrix& A) {
885 dat = new interval[A.m*A.n];
886 lb1 = A.lb1; lb2 = A.lb2; ub1 = A.ub1; ub2 = A.ub2;
887 xsize = A.n;
888 ysize = A.m;
889 *this = 0.0;
890 for(int j=0 ; j<A.n ; j++) {
891 for(int k=A.p[j] ; k<A.p[j+1] ; k++) {
892 dat[A.ind[k]*A.n+j] = A.x[k];
893 }
894 }
895}
896
897inline imatrix::imatrix(const simatrix& A) {
898 dat = new interval[A.m*A.n];
899 lb1 = A.lb1; lb2 = A.lb2; ub1 = A.ub1; ub2 = A.ub2;
900 xsize = A.n;
901 ysize = A.m;
902 *this = 0.0;
903 for(int j=0 ; j<A.n ; j++) {
904 for(int k=A.p[j] ; k<A.p[j+1] ; k++) {
905 dat[A.ind[k]*A.n+j] = A.x[k];
906 }
907 }
908}
909
911inline simatrix Id(const simatrix& A) {
912 simatrix I(A.m, A.n, (A.m>A.n) ? A.m : A.n);
913 I.lb1 = A.lb1; I.lb2 = A.lb2;
914 I.ub1 = A.ub1; I.ub2 = A.ub2;
915
916 if(A.m < A.n) {
917 for(int i=0 ; i<A.m ; i++) {
918 I.p[i+1] = I.p[i] + 1;
919 I.ind.push_back(i);
920 I.x.push_back(interval(1.0));
921 }
922 } else {
923 for(int i=0 ; i<A.n ; i++) {
924 I.p[i+1] = I.p[i] + 1;
925 I.ind.push_back(i);
926 I.x.push_back(interval(1.0));
927 }
928 }
929
930 return I;
931}
932
934inline simatrix transp(const simatrix& A) {
935 simatrix B(A.n, A.m, A.get_nnz());
936
937 //NIchtnullen pro Zeile bestimmen
938 std::vector<int> w(A.m,0);
939 for(unsigned int i=0 ; i<A.ind.size() ; i++)
940 w[A.ind[i]]++;
941
942 //Spalten"pointer" setzen
943 B.p.resize(A.m+1);
944 B.p[0] = 0;
945 for(unsigned int i=1 ; i<B.p.size() ; i++)
946 B.p[i] = w[i-1] + B.p[i-1];
947
948 //w vorbereiten
949 w.insert(w.begin(), 0);
950 for(unsigned int i=1 ; i<w.size() ; i++) {
951 w[i] += w[i-1];
952 }
953
954 //neuer zeilenindex und wert wird gesetzt
955 int q;
956 B.ind.resize(A.get_nnz());
957 B.x.resize(A.get_nnz());
958 for(int j=0 ; j<A.n ; j++) {
959 for(int k=A.p[j] ; k<A.p[j+1] ; k++) {
960 q = w[A.ind[k]]++;
961 B.ind[q] = j;
962 B.x[q] = A.x[k];
963 }
964 }
965
966 return B;
967}
968
970
974inline void SetLb(simatrix& A, const int i, const int j) {
975 if(i==1) {
976 A.lb1 = j;
977 A.ub1 = j + A.m - 1;
978 } else if(i==2) {
979 A.lb2 = j;
980 A.ub2 = j + A.n - 1;
981 }
982}
983
985
989inline void SetUb(simatrix& A, const int i, const int j) {
990 if(i==1) {
991 A.ub1 = j;
992 A.lb1 = j - A.m + 1;
993 } else if(i==2) {
994 A.ub2 = j;
995 A.lb2 = j - A.n + 1;
996 }
997}
998
1000
1003inline int Lb(const simatrix& A, int i) {
1004 if(i==1)
1005 return A.lb1;
1006 else if(i==2)
1007 return A.lb2;
1008 else
1009 return 1;
1010}
1011
1013
1016inline int Ub(const simatrix& A, int i) {
1017 if(i==1)
1018 return A.ub1;
1019 else if(i==2)
1020 return A.ub2;
1021 else
1022 return 1;
1023}
1024
1026inline int RowLen(const simatrix& A) {
1027 return A.n;
1028}
1029
1031inline int ColLen(const simatrix& A) {
1032 return A.m;
1033}
1034
1036inline void Resize(simatrix& A) {
1037 sp_m_resize(A);
1038}
1039
1041inline void Resize(simatrix& A, const int m, const int n) {
1042 sp_m_resize(A,m,n);
1043}
1044
1046inline void Resize(simatrix& A, const int l1, const int u1, const int l2, const int u2) {
1047 sp_m_resize(A,l1,u1,l2,u2);
1048}
1049
1051inline srmatrix Inf(const simatrix& A) {
1052 srmatrix res(A.m,A.n,A.get_nnz());
1053 res.lb1 = A.lb1;
1054 res.lb2 = A.lb2;
1055 res.ub1 = A.ub1;
1056 res.ub2 = A.ub2;
1057 res.p = A.p;
1058 res.ind = A.ind;
1059
1060 for(int i=0 ; i<res.get_nnz() ; i++)
1061 res.x.push_back(Inf(A.x[i]));
1062
1063 res.dropzeros();
1064
1065 return res;
1066}
1067
1069inline srmatrix Sup(const simatrix& A) {
1070 srmatrix res(A.m,A.n,A.get_nnz());
1071 res.lb1 = A.lb1;
1072 res.lb2 = A.lb2;
1073 res.ub1 = A.ub1;
1074 res.ub2 = A.ub2;
1075 res.p = A.p;
1076 res.ind = A.ind;
1077
1078 for(int i=0 ; i<res.get_nnz() ; i++)
1079 res.x.push_back(Sup(A.x[i]));
1080
1081 res.dropzeros();
1082
1083 return res;
1084}
1085
1087inline simatrix abs(const simatrix& A) {
1088 simatrix res(A.m,A.n,A.get_nnz());
1089 res.lb1 = A.lb1;
1090 res.lb2 = A.lb2;
1091 res.ub1 = A.ub1;
1092 res.ub2 = A.ub2;
1093 res.p = A.p;
1094 res.ind = A.ind;
1095
1096 for(int i=0 ; i<res.get_nnz() ; i++)
1097 res.x.push_back(abs(A.x[i]));
1098
1099 res.dropzeros();
1100
1101 return res;
1102}
1103
1105inline srmatrix absmin(const simatrix& A) {
1106 srmatrix res(A.m,A.n,A.get_nnz());
1107 res.lb1 = A.lb1;
1108 res.lb2 = A.lb2;
1109 res.ub1 = A.ub1;
1110 res.ub2 = A.ub2;
1111 res.p = A.p;
1112 res.ind = A.ind;
1113
1114 for(int i=0 ; i<res.get_nnz() ; i++)
1115 res.x.push_back(AbsMin(A.x[i]));
1116
1117 res.dropzeros();
1118
1119 return res;
1120}
1121
1123inline srmatrix absmax(const simatrix& A) {
1124 srmatrix res(A.m,A.n,A.get_nnz());
1125 res.lb1 = A.lb1;
1126 res.lb2 = A.lb2;
1127 res.ub1 = A.ub1;
1128 res.ub2 = A.ub2;
1129 res.p = A.p;
1130 res.ind = A.ind;
1131
1132 for(int i=0 ; i<res.get_nnz() ; i++)
1133 res.x.push_back(AbsMax(A.x[i]));
1134
1135 res.dropzeros();
1136
1137 return res;
1138}
1139
1141inline srmatrix CompMat(const simatrix& A) {
1142 srmatrix res(A.m,A.n,A.get_nnz());
1143 res.lb1 = A.lb1;
1144 res.lb2 = A.lb2;
1145 res.ub1 = A.ub1;
1146 res.ub2 = A.ub2;
1147 res.p = A.p;
1148 res.ind = A.ind;
1149 res.p[A.n] = A.p[A.n];
1150
1151 for(int j=0 ; j<res.n ; j++) {
1152 for(int k=A.p[j] ; k<A.p[j+1] ; k++) {
1153 if(A.ind[k] == j)
1154 res.x.push_back(AbsMin(A.x[k]));
1155 else
1156 res.x.push_back(-AbsMax(A.x[k]));
1157 }
1158 }
1159
1160 res.dropzeros();
1161
1162 return res;
1163}
1164
1166inline srmatrix mid(const simatrix& A) {
1167 srmatrix res(A.m,A.n,A.get_nnz());
1168 res.lb1 = A.lb1;
1169 res.lb2 = A.lb2;
1170 res.ub1 = A.ub1;
1171 res.ub2 = A.ub2;
1172 res.p = A.p;
1173 res.ind = A.ind;
1174
1175 for(int i=0 ; i<res.get_nnz() ; i++)
1176 res.x.push_back(mid(A.x[i]));
1177
1178 res.dropzeros();
1179
1180 return res;
1181}
1182
1184inline srmatrix diam(const simatrix& A) {
1185 srmatrix res(A.m,A.n,A.get_nnz());
1186 res.lb1 = A.lb1;
1187 res.lb2 = A.lb2;
1188 res.ub1 = A.ub1;
1189 res.ub2 = A.ub2;
1190 res.p = A.p;
1191 res.ind = A.ind;
1192
1193 for(int i=0 ; i<res.get_nnz() ; i++)
1194 res.x.push_back(diam(A.x[i]));
1195
1196 res.dropzeros();
1197
1198 return res;
1199}
1200
1201
1203
1209inline imatrix operator*(const imatrix& A, const srmatrix& B) {
1210 return fsp_mm_mult<imatrix,srmatrix,imatrix,sparse_idot>(A,B);
1211}
1212
1214
1220inline imatrix operator*(const rmatrix& A, const simatrix& B) {
1221 return fsp_mm_mult<rmatrix,simatrix,imatrix,sparse_idot>(A,B);
1222}
1223
1225
1231inline imatrix operator*(const imatrix& A, const simatrix& B) {
1232 return fsp_mm_mult<imatrix,simatrix,imatrix,sparse_idot>(A,B);
1233}
1234
1236
1242inline imatrix operator*(const simatrix& A, const rmatrix& B) {
1243 return spf_mm_mult<simatrix,rmatrix,imatrix,sparse_idot>(A,B);
1244}
1245
1247
1253inline imatrix operator*(const srmatrix& A, const imatrix& B) {
1254 return spf_mm_mult<srmatrix,imatrix,imatrix,sparse_idot>(A,B);
1255}
1256
1258
1264inline imatrix operator*(const simatrix& A, const imatrix& B) {
1265 return spf_mm_mult<simatrix,imatrix,imatrix,sparse_idot>(A,B);
1266}
1267
1269
1275inline imatrix operator*(const imatrix_slice& A, const srmatrix& B) {
1276 return fsp_mm_mult<imatrix_slice,srmatrix,imatrix,sparse_idot>(A,B);
1277}
1278
1280
1286inline imatrix operator*(const rmatrix_slice& A, const simatrix& B) {
1287 return fsp_mm_mult<rmatrix_slice,simatrix,imatrix,sparse_idot>(A,B);
1288}
1289
1291
1297inline imatrix operator*(const imatrix_slice& A, const simatrix& B) {
1298 return fsp_mm_mult<imatrix_slice,simatrix,imatrix,sparse_idot>(A,B);
1299}
1300
1302
1308inline imatrix operator*(const simatrix& A, const rmatrix_slice& B) {
1309 return spf_mm_mult<simatrix,rmatrix_slice,imatrix,sparse_idot>(A,B);
1310}
1311
1313
1319inline imatrix operator*(const srmatrix& A, const imatrix_slice& B) {
1320 return spf_mm_mult<srmatrix,imatrix_slice,imatrix,sparse_idot>(A,B);
1321}
1322
1324
1330inline imatrix operator*(const simatrix& A, const imatrix_slice& B) {
1331 return spf_mm_mult<simatrix,imatrix_slice,imatrix,sparse_idot>(A,B);
1332}
1333
1335
1341inline simatrix operator*(const simatrix& A, const srmatrix& B) {
1342 return spsp_mm_mult<simatrix,srmatrix,simatrix,sparse_idot,interval>(A,B);
1343}
1344
1346
1352inline simatrix operator*(const srmatrix& A, const simatrix& B) {
1353 return spsp_mm_mult<srmatrix,simatrix,simatrix,sparse_idot,interval>(A,B);
1354}
1355
1357
1363inline simatrix operator*(const simatrix& A, const simatrix& B) {
1364 return spsp_mm_mult<simatrix,simatrix,simatrix,sparse_idot,interval>(A,B);
1365}
1366
1368inline simatrix operator/(const simatrix& A, const real& r) {
1369 return sp_ms_div<simatrix,real,simatrix>(A,r);
1370}
1371
1373inline simatrix operator/(const simatrix& A, const interval& r) {
1374 return sp_ms_div<simatrix,interval,simatrix>(A,r);
1375}
1376
1378inline simatrix operator/(const srmatrix& A, const interval& r) {
1379 return sp_ms_div<srmatrix,interval,simatrix>(A,r);
1380}
1381
1383inline simatrix operator*(const simatrix& A, const real& r) {
1384 return sp_ms_mult<simatrix,real,simatrix>(A,r);
1385}
1386
1388inline simatrix operator*(const simatrix& A, const interval& r) {
1389 return sp_ms_mult<simatrix,interval,simatrix>(A,r);
1390}
1391
1393inline simatrix operator*(const srmatrix& A, const interval& r) {
1394 return sp_ms_mult<srmatrix,interval,simatrix>(A,r);
1395}
1396
1398inline simatrix operator*(const real& r, const simatrix& A) {
1399 return sp_sm_mult<real,simatrix,simatrix>(r,A);
1400}
1401
1403inline simatrix operator*(const interval& r, const simatrix& A) {
1404 return sp_sm_mult<interval,simatrix,simatrix>(r,A);
1405}
1406
1408inline simatrix operator*(const interval& r, const srmatrix& A) {
1409 return sp_sm_mult<interval,srmatrix,simatrix>(r,A);
1410}
1411
1413
1419inline ivector operator*(const simatrix& A, const rvector& v) {
1420 return spf_mv_mult<simatrix,rvector,ivector,sparse_idot>(A,v);
1421}
1422
1424
1430inline ivector operator*(const srmatrix& A, const ivector& v) {
1431 return spf_mv_mult<srmatrix,ivector,ivector,sparse_idot>(A,v);
1432}
1433
1435
1441inline ivector operator*(const simatrix& A, const ivector& v) {
1442 return spf_mv_mult<simatrix,ivector,ivector,sparse_idot>(A,v);
1443}
1444
1446
1452inline ivector operator*(const simatrix& A, const rvector_slice& v) {
1453 return spf_mv_mult<simatrix,rvector_slice,ivector,sparse_idot>(A,v);
1454}
1455
1457
1463inline ivector operator*(const srmatrix& A, const ivector_slice& v) {
1464 return spf_mv_mult<srmatrix,ivector_slice,ivector,sparse_idot>(A,v);
1465}
1466
1468
1474inline ivector operator*(const simatrix& A, const ivector_slice& v) {
1475 return spf_mv_mult<simatrix,ivector_slice,ivector,sparse_idot>(A,v);
1476}
1477
1479
1485inline sivector operator*(const simatrix& A, const srvector& v) {
1486 return spsp_mv_mult<simatrix,srvector,sivector,sparse_idot,interval>(A,v);
1487}
1488
1490
1496inline sivector operator*(const srmatrix& A, const sivector& v) {
1497 return spsp_mv_mult<srmatrix,sivector,sivector,sparse_idot,interval>(A,v);
1498}
1499
1501
1507inline sivector operator*(const simatrix& A, const sivector& v) {
1508 return spsp_mv_mult<simatrix,sivector,sivector,sparse_idot,interval>(A,v);
1509}
1510
1512
1518inline sivector operator*(const simatrix& A, const srvector_slice& v) {
1519 return spsl_mv_mult<simatrix,srvector_slice,sivector,sparse_idot,interval>(A,v);
1520}
1521
1523
1529inline sivector operator*(const srmatrix& A, const sivector_slice& v) {
1530 return spsl_mv_mult<srmatrix,sivector_slice,sivector,sparse_idot,interval>(A,v);
1531}
1532
1534
1540inline sivector operator*(const simatrix& A, const sivector_slice& v) {
1541 return spsl_mv_mult<simatrix,sivector_slice,sivector,sparse_idot,interval>(A,v);
1542}
1543
1545
1551inline ivector operator*(const imatrix& A, const srvector& v) {
1552 return fsp_mv_mult<imatrix,srvector,ivector,sparse_idot>(A,v);
1553}
1554
1556
1562inline ivector operator*(const rmatrix& A, const sivector& v) {
1563 return fsp_mv_mult<rmatrix,sivector,ivector,sparse_idot>(A,v);
1564}
1565
1567
1573inline ivector operator*(const imatrix& A, const sivector& v) {
1574 return fsp_mv_mult<imatrix,sivector,ivector,sparse_idot>(A,v);
1575}
1576
1578
1584inline ivector operator*(const imatrix_slice& A, const srvector& v) {
1585 return fsp_mv_mult<imatrix_slice,srvector,ivector,sparse_idot>(A,v);
1586}
1587
1589
1595inline ivector operator*(const rmatrix_slice& A, const sivector& v) {
1596 return fsp_mv_mult<rmatrix_slice,sivector,ivector,sparse_idot>(A,v);
1597}
1598
1600
1606inline ivector operator*(const imatrix_slice& A, const sivector& v) {
1607 return fsp_mv_mult<imatrix_slice,sivector,ivector,sparse_idot>(A,v);
1608}
1609
1611
1617inline ivector operator*(const imatrix& A, const srvector_slice& v) {
1618 return fsl_mv_mult<imatrix,srvector_slice,ivector,sparse_idot>(A,v);
1619}
1620
1622
1628inline ivector operator*(const rmatrix& A, const sivector_slice& v) {
1629 return fsl_mv_mult<rmatrix,sivector_slice,ivector,sparse_idot>(A,v);
1630}
1631
1633
1639inline ivector operator*(const imatrix& A, const sivector_slice& v) {
1640 return fsl_mv_mult<imatrix,sivector_slice,ivector,sparse_idot>(A,v);
1641}
1642
1644
1650inline ivector operator*(const imatrix_slice& A, const srvector_slice& v) {
1651 return fsl_mv_mult<imatrix_slice,srvector_slice,ivector,sparse_idot>(A,v);
1652}
1653
1655
1661inline ivector operator*(const rmatrix_slice& A, const sivector_slice& v) {
1662 return fsl_mv_mult<rmatrix_slice,sivector_slice,ivector,sparse_idot>(A,v);
1663}
1664
1666
1672inline ivector operator*(const imatrix_slice& A, const sivector_slice& v) {
1673 return fsl_mv_mult<imatrix_slice,sivector_slice,ivector,sparse_idot>(A,v);
1674}
1675
1677inline imatrix operator+(const imatrix& A, const srmatrix& B) {
1678 return fsp_mm_add<imatrix,srmatrix,imatrix>(A,B);
1679}
1680
1682inline imatrix operator+(const rmatrix& A, const simatrix& B) {
1683 return fsp_mm_add<rmatrix,simatrix,imatrix>(A,B);
1684}
1685
1687inline imatrix operator+(const imatrix& A, const simatrix& B) {
1688 return fsp_mm_add<imatrix,simatrix,imatrix>(A,B);
1689}
1690
1692inline imatrix operator+(const simatrix& A, const rmatrix& B) {
1693 return spf_mm_add<simatrix,rmatrix,imatrix>(A,B);
1694}
1695
1697inline imatrix operator+(const srmatrix& A, const imatrix& B) {
1698 return spf_mm_add<srmatrix,imatrix,imatrix>(A,B);
1699}
1700
1702inline imatrix operator+(const simatrix& A, const imatrix& B) {
1703 return spf_mm_add<simatrix,imatrix,imatrix>(A,B);
1704}
1705
1707inline imatrix operator+(const imatrix_slice& A, const srmatrix& B) {
1708 return fsp_mm_add<imatrix_slice,srmatrix,imatrix>(A,B);
1709}
1710
1712inline imatrix operator+(const rmatrix_slice& A, const simatrix& B) {
1713 return fsp_mm_add<rmatrix_slice,simatrix,imatrix>(A,B);
1714}
1715
1717inline imatrix operator+(const imatrix_slice& A, const simatrix& B) {
1718 return fsp_mm_add<imatrix_slice,simatrix,imatrix>(A,B);
1719}
1720
1722inline imatrix operator+(const simatrix& A, const rmatrix_slice& B) {
1723 return spf_mm_add<simatrix,rmatrix_slice,imatrix>(A,B);
1724}
1725
1727inline imatrix operator+(const srmatrix& A, const imatrix_slice& B) {
1728 return spf_mm_add<srmatrix,imatrix_slice,imatrix>(A,B);
1729}
1730
1732inline imatrix operator+(const simatrix& A, const imatrix_slice& B) {
1733 return spf_mm_add<simatrix,imatrix_slice,imatrix>(A,B);
1734}
1735
1737inline simatrix operator+(const simatrix& A, const srmatrix& B) {
1738 return spsp_mm_add<simatrix,srmatrix,simatrix,interval>(A,B);
1739}
1740
1742inline simatrix operator+(const srmatrix& A, const simatrix& B) {
1743 return spsp_mm_add<srmatrix,simatrix,simatrix,interval>(A,B);
1744}
1745
1747inline simatrix operator+(const simatrix& A, const simatrix& B) {
1748 return spsp_mm_add<simatrix,simatrix,simatrix,interval>(A,B);
1749}
1750
1752inline imatrix operator-(const imatrix& A, const srmatrix& B) {
1753 return fsp_mm_sub<imatrix,srmatrix,imatrix>(A,B);
1754}
1755
1757inline imatrix operator-(const rmatrix& A, const simatrix& B) {
1758 return fsp_mm_sub<rmatrix,simatrix,imatrix>(A,B);
1759}
1760
1762inline imatrix operator-(const imatrix& A, const simatrix& B) {
1763 return fsp_mm_sub<imatrix,simatrix,imatrix>(A,B);
1764}
1765
1767inline imatrix operator-(const simatrix& A, const rmatrix& B) {
1768 return spf_mm_sub<simatrix,rmatrix,imatrix>(A,B);
1769}
1770
1772inline imatrix operator-(const srmatrix& A, const imatrix& B) {
1773 return spf_mm_sub<srmatrix,imatrix,imatrix>(A,B);
1774}
1775
1777inline imatrix operator-(const simatrix& A, const imatrix& B) {
1778 return spf_mm_sub<simatrix,imatrix,imatrix>(A,B);
1779}
1780
1782inline imatrix operator-(const imatrix_slice& A, const srmatrix& B) {
1783 return fsp_mm_sub<imatrix_slice,srmatrix,imatrix>(A,B);
1784}
1785
1787inline imatrix operator-(const rmatrix_slice& A, const simatrix& B) {
1788 return fsp_mm_sub<rmatrix_slice,simatrix,imatrix>(A,B);
1789}
1790
1792inline imatrix operator-(const imatrix_slice& A, const simatrix& B) {
1793 return fsp_mm_sub<imatrix_slice,simatrix,imatrix>(A,B);
1794}
1795
1797inline imatrix operator-(const simatrix& A, const rmatrix_slice& B) {
1798 return spf_mm_sub<simatrix,rmatrix_slice,imatrix>(A,B);
1799}
1800
1802inline imatrix operator-(const srmatrix& A, const imatrix_slice& B) {
1803 return spf_mm_sub<srmatrix,imatrix_slice,imatrix>(A,B);
1804}
1805
1807inline imatrix operator-(const simatrix& A, const imatrix_slice& B) {
1808 return spf_mm_sub<simatrix,imatrix_slice,imatrix>(A,B);
1809}
1810
1812inline simatrix operator-(const simatrix& A, const srmatrix& B) {
1813 return spsp_mm_sub<simatrix,srmatrix,simatrix,interval>(A,B);
1814}
1815
1817inline simatrix operator-(const srmatrix& A, const simatrix& B) {
1818 return spsp_mm_sub<srmatrix,simatrix,simatrix,interval>(A,B);
1819}
1820
1822inline simatrix operator-(const simatrix& A, const simatrix& B) {
1823 return spsp_mm_sub<simatrix,simatrix,simatrix,interval>(A,B);
1824}
1825
1827inline imatrix operator|(const imatrix& A, const srmatrix& B) {
1828 return fsp_mm_hull<imatrix,srmatrix,imatrix>(A,B);
1829}
1830
1832inline imatrix operator|(const rmatrix& A, const simatrix& B) {
1833 return fsp_mm_hull<rmatrix,simatrix,imatrix>(A,B);
1834}
1835
1837inline imatrix operator|(const imatrix& A, const simatrix& B) {
1838 return fsp_mm_hull<imatrix,simatrix,imatrix>(A,B);
1839}
1840
1842inline imatrix operator|(const simatrix& A, const rmatrix& B) {
1843 return spf_mm_hull<simatrix,rmatrix,imatrix>(A,B);
1844}
1845
1847inline imatrix operator|(const srmatrix& A, const imatrix& B) {
1848 return spf_mm_hull<srmatrix,imatrix,imatrix>(A,B);
1849}
1850
1852inline imatrix operator|(const simatrix& A, const imatrix& B) {
1853 return spf_mm_hull<simatrix,imatrix,imatrix>(A,B);
1854}
1855
1857inline imatrix operator|(const imatrix_slice& A, const srmatrix& B) {
1858 return fsp_mm_hull<imatrix_slice,srmatrix,imatrix>(A,B);
1859}
1860
1862inline imatrix operator|(const rmatrix_slice& A, const simatrix& B) {
1863 return fsp_mm_hull<rmatrix_slice,simatrix,imatrix>(A,B);
1864}
1865
1867inline imatrix operator|(const imatrix_slice& A, const simatrix& B) {
1868 return fsp_mm_hull<imatrix_slice,simatrix,imatrix>(A,B);
1869}
1870
1872inline imatrix operator|(const simatrix& A, const rmatrix_slice& B) {
1873 return spf_mm_hull<simatrix,rmatrix_slice,imatrix>(A,B);
1874}
1875
1877inline imatrix operator|(const srmatrix& A, const imatrix_slice& B) {
1878 return spf_mm_hull<srmatrix,imatrix_slice,imatrix>(A,B);
1879}
1880
1882inline imatrix operator|(const simatrix& A, const imatrix_slice& B) {
1883 return spf_mm_hull<simatrix,imatrix_slice,imatrix>(A,B);
1884}
1885
1887inline simatrix operator|(const simatrix& A, const srmatrix& B) {
1888 return spsp_mm_hull<simatrix,srmatrix,simatrix,interval>(A,B);
1889}
1890
1892inline simatrix operator|(const srmatrix& A, const simatrix& B) {
1893 return spsp_mm_hull<srmatrix,simatrix,simatrix,interval>(A,B);
1894}
1895
1897inline simatrix operator|(const simatrix& A, const simatrix& B) {
1898 return spsp_mm_hull<simatrix,simatrix,simatrix,interval>(A,B);
1899}
1900
1902inline imatrix operator|(const rmatrix& A, const srmatrix& B) {
1903 return fsp_mm_hull<rmatrix,srmatrix,imatrix>(A,B);
1904}
1905
1907inline imatrix operator|(const srmatrix& A, const rmatrix& B) {
1908 return spf_mm_hull<srmatrix,rmatrix,imatrix>(A,B);
1909}
1910
1912inline imatrix operator|(const rmatrix_slice& A, const srmatrix& B) {
1913 return fsp_mm_hull<rmatrix_slice,srmatrix,imatrix>(A,B);
1914}
1915
1917inline imatrix operator|(const srmatrix& A, const rmatrix_slice& B) {
1918 return spf_mm_hull<srmatrix,rmatrix_slice,imatrix>(A,B);
1919}
1920
1922inline simatrix operator|(const srmatrix& A, const srmatrix& B) {
1923 return spsp_mm_hull<srmatrix,srmatrix,simatrix,interval>(A,B);
1924}
1925
1927inline imatrix operator&(const imatrix& A, const simatrix& B) {
1928 return fsp_mm_intersect<imatrix,simatrix,imatrix>(A,B);
1929}
1930
1932inline imatrix operator&(const simatrix& A, const imatrix& B) {
1933 return spf_mm_intersect<simatrix,imatrix,imatrix>(A,B);
1934}
1935
1937inline imatrix operator&(const imatrix_slice& A, const simatrix& B) {
1938 return fsp_mm_intersect<imatrix_slice,simatrix,imatrix>(A,B);
1939}
1940
1942inline imatrix operator&(const simatrix& A, const imatrix_slice& B) {
1943 return spf_mm_intersect<simatrix,imatrix_slice,imatrix>(A,B);
1944}
1945
1947inline simatrix operator&(const simatrix& A, const simatrix& B) {
1948 return spsp_mm_intersect<simatrix,simatrix,simatrix,interval>(A,B);
1949}
1950
1952inline simatrix operator-(const simatrix& M) {
1953 return sp_m_negative<simatrix,simatrix>(M);
1954}
1955
1957inline simatrix& operator+(simatrix& A) {
1958 return A;
1959}
1960
1962 *this = rmatrix(B);
1963 return *this;
1964}
1965
1967 *this = imatrix(B);
1968 return *this;
1969}
1970
1972 return fsp_mm_addassign(*this,B);
1973}
1974
1976 return fsp_mm_addassign(*this,B);
1977}
1978
1980 return fsp_mm_addassign(*this,B);
1981}
1982
1984 return fsp_mm_addassign(*this,B);
1985}
1986
1988 return fsp_mm_subassign(*this,B);
1989}
1990
1992 return fsp_mm_subassign(*this,B);
1993}
1994
1996 return fsp_mm_subassign(*this,B);
1997}
1998
2000 return fsp_mm_subassign(*this,B);
2001}
2002
2004 return fsp_mm_multassign<imatrix,srmatrix,sparse_idot,imatrix>(*this,B);
2005}
2006
2008 return fsp_mm_multassign<imatrix,simatrix,sparse_idot,imatrix>(*this,B);
2009}
2010
2012 return fsp_mm_multassign<imatrix_slice,srmatrix,sparse_idot,imatrix>(*this,B);
2013}
2014
2016 return fsp_mm_multassign<imatrix_slice,simatrix,sparse_idot,imatrix>(*this,B);
2017}
2018
2020 return fsp_mm_hullassign(*this,B);
2021}
2022
2024 return fsp_mm_hullassign(*this,B);
2025}
2026
2028 return fsp_mm_hullassign(*this,B);
2029}
2030
2032 return fsp_mm_hullassign(*this,B);
2033}
2034
2036 return fsp_mm_intersectassign(*this,B);
2037}
2038
2040 return fsp_mm_intersectassign(*this,B);
2041}
2042
2044 return fsp_mm_intersectassign(*this,B);
2045}
2046
2048 return fsp_mm_intersectassign(*this,B);
2049}
2050
2052inline bool operator==(const simatrix& A, const srmatrix& B) {
2053 return spsp_mm_comp(A,B);
2054}
2055
2057inline bool operator==(const srmatrix& A, const simatrix& B) {
2058 return spsp_mm_comp(A,B);
2059}
2060
2062inline bool operator==(const simatrix& A, const simatrix& B) {
2063 return spsp_mm_comp(A,B);
2064}
2065
2067inline bool operator==(const simatrix& A, const rmatrix& B) {
2068 return spf_mm_comp(A,B);
2069}
2070
2072inline bool operator==(const srmatrix& A, const imatrix& B) {
2073 return spf_mm_comp(A,B);
2074}
2075
2077inline bool operator==(const simatrix& A, const imatrix& B) {
2078 return spf_mm_comp(A,B);
2079}
2080
2082inline bool operator==(const imatrix& A, const srmatrix& B) {
2083 return fsp_mm_comp(A,B);
2084}
2085
2087inline bool operator==(const rmatrix& A, const simatrix& B) {
2088 return fsp_mm_comp(A,B);
2089}
2090
2092inline bool operator==(const imatrix& A, const simatrix& B) {
2093 return fsp_mm_comp(A,B);
2094}
2095
2097inline bool operator==(const imatrix_slice& A, const srmatrix& B) {
2098 return fsp_mm_comp(A,B);
2099}
2100
2102inline bool operator==(const rmatrix_slice& A, const simatrix& B) {
2103 return fsp_mm_comp(A,B);
2104}
2105
2107inline bool operator==(const imatrix_slice& A, const simatrix& B) {
2108 return fsp_mm_comp(A,B);
2109}
2110
2112inline bool operator==(const simatrix& A, const rmatrix_slice& B) {
2113 return spf_mm_comp(A,B);
2114}
2115
2117inline bool operator==(const srmatrix& A, const imatrix_slice& B) {
2118 return spf_mm_comp(A,B);
2119}
2120
2122inline bool operator==(const simatrix& A, const imatrix_slice& B) {
2123 return spf_mm_comp(A,B);
2124}
2125
2127inline bool operator!=(const simatrix& A, const srmatrix& B) {
2128 return !spsp_mm_comp(A,B);
2129}
2130
2132inline bool operator!=(const srmatrix& A, const simatrix& B) {
2133 return !spsp_mm_comp(A,B);
2134}
2135
2137inline bool operator!=(const simatrix& A, const simatrix& B) {
2138 return !spsp_mm_comp(A,B);
2139}
2140
2142inline bool operator!=(const simatrix& A, const rmatrix& B) {
2143 return !spf_mm_comp(A,B);
2144}
2145
2147inline bool operator!=(const srmatrix& A, const imatrix& B) {
2148 return !spf_mm_comp(A,B);
2149}
2150
2152inline bool operator!=(const simatrix& A, const imatrix& B) {
2153 return !spf_mm_comp(A,B);
2154}
2155
2157inline bool operator!=(const imatrix& A, const srmatrix& B) {
2158 return !fsp_mm_comp(A,B);
2159}
2160
2162inline bool operator!=(const rmatrix& A, const simatrix& B) {
2163 return !fsp_mm_comp(A,B);
2164}
2165
2167inline bool operator!=(const imatrix& A, const simatrix& B) {
2168 return !fsp_mm_comp(A,B);
2169}
2170
2172inline bool operator!=(const imatrix_slice& A, const srmatrix& B) {
2173 return !fsp_mm_comp(A,B);
2174}
2175
2177inline bool operator!=(const rmatrix_slice& A, const simatrix& B) {
2178 return !fsp_mm_comp(A,B);
2179}
2180
2182inline bool operator!=(const imatrix_slice& A, const simatrix& B) {
2183 return !fsp_mm_comp(A,B);
2184}
2185
2187inline bool operator!=(const simatrix& A, const rmatrix_slice& B) {
2188 return !spf_mm_comp(A,B);
2189}
2190
2192inline bool operator!=(const srmatrix& A, const imatrix_slice& B) {
2193 return !spf_mm_comp(A,B);
2194}
2195
2197inline bool operator!=(const simatrix& A, const imatrix_slice& B) {
2198 return !spf_mm_comp(A,B);
2199}
2200
2202inline bool operator<(const srmatrix& A, const simatrix& B) {
2203 return spsp_mm_less<srmatrix,simatrix,interval>(A,B);
2204}
2205
2207inline bool operator<(const simatrix& A, const simatrix& B) {
2208 return spsp_mm_less<simatrix,simatrix,interval>(A,B);
2209}
2210
2212inline bool operator<(const srmatrix& A, const imatrix& B) {
2213 return spf_mm_less<srmatrix,imatrix,interval>(A,B);
2214}
2215
2217inline bool operator<(const simatrix& A, const imatrix& B) {
2218 return spf_mm_less<simatrix,imatrix,interval>(A,B);
2219}
2220
2222inline bool operator<(const rmatrix& A, const simatrix& B) {
2223 return fsp_mm_less<rmatrix,simatrix,interval>(A,B);
2224}
2225
2227inline bool operator<(const imatrix& A, const simatrix& B) {
2228 return fsp_mm_less<imatrix,simatrix,interval>(A,B);
2229}
2230
2232inline bool operator<(const rmatrix_slice& A, const simatrix& B) {
2233 return fsp_mm_less<rmatrix_slice,simatrix,interval>(A,B);
2234}
2235
2237inline bool operator<(const imatrix_slice& A, const simatrix& B) {
2238 return fsp_mm_less<imatrix_slice,simatrix,interval>(A,B);
2239}
2240
2242inline bool operator<(const srmatrix& A, const imatrix_slice& B) {
2243 return spf_mm_less<srmatrix,imatrix_slice,interval>(A,B);
2244}
2245
2247inline bool operator<(const simatrix& A, const imatrix_slice& B) {
2248 return spf_mm_less<simatrix,imatrix_slice,interval>(A,B);
2249}
2250
2252inline bool operator<=(const srmatrix& A, const simatrix& B) {
2253 return spsp_mm_leq<srmatrix,simatrix,interval>(A,B);
2254}
2255
2257inline bool operator<=(const simatrix& A, const simatrix& B) {
2258 return spsp_mm_leq<simatrix,simatrix,interval>(A,B);
2259}
2260
2262inline bool operator<=(const srmatrix& A, const imatrix& B) {
2263 return spf_mm_leq<srmatrix,imatrix,interval>(A,B);
2264}
2265
2267inline bool operator<=(const simatrix& A, const imatrix& B) {
2268 return spf_mm_leq<simatrix,imatrix,interval>(A,B);
2269}
2270
2272inline bool operator<=(const rmatrix& A, const simatrix& B) {
2273 return fsp_mm_leq<rmatrix,simatrix,interval>(A,B);
2274}
2275
2277inline bool operator<=(const imatrix& A, const simatrix& B) {
2278 return fsp_mm_leq<imatrix,simatrix,interval>(A,B);
2279}
2280
2282inline bool operator<=(const rmatrix_slice& A, const simatrix& B) {
2283 return fsp_mm_leq<rmatrix_slice,simatrix,interval>(A,B);
2284}
2285
2287inline bool operator<=(const imatrix_slice& A, const simatrix& B) {
2288 return fsp_mm_leq<imatrix_slice,simatrix,interval>(A,B);
2289}
2290
2292inline bool operator<=(const srmatrix& A, const imatrix_slice& B) {
2293 return spf_mm_leq<srmatrix,imatrix_slice,interval>(A,B);
2294}
2295
2297inline bool operator<=(const simatrix& A, const imatrix_slice& B) {
2298 return spf_mm_leq<simatrix,imatrix_slice,interval>(A,B);
2299}
2300
2302inline bool operator>(const simatrix& A, const srmatrix& B) {
2303 return spsp_mm_greater<simatrix,srmatrix,interval>(A,B);
2304}
2305
2307inline bool operator>(const simatrix& A, const simatrix& B) {
2308 return spsp_mm_greater<simatrix,simatrix,interval>(A,B);
2309}
2310
2312inline bool operator>(const simatrix& A, const rmatrix& B) {
2313 return spf_mm_greater<simatrix,rmatrix,interval>(A,B);
2314}
2315
2317inline bool operator>(const simatrix& A, const imatrix& B) {
2318 return spf_mm_greater<simatrix,imatrix,interval>(A,B);
2319}
2320
2322inline bool operator>(const imatrix& A, const srmatrix& B) {
2323 return fsp_mm_greater<imatrix,srmatrix,interval>(A,B);
2324}
2325
2327inline bool operator>(const imatrix& A, const simatrix& B) {
2328 return fsp_mm_greater<imatrix,simatrix,interval>(A,B);
2329}
2330
2332inline bool operator>(const imatrix_slice& A, const srmatrix& B) {
2333 return fsp_mm_greater<imatrix_slice,srmatrix,interval>(A,B);
2334}
2335
2337inline bool operator>(const imatrix_slice& A, const simatrix& B) {
2338 return fsp_mm_greater<imatrix_slice,simatrix,interval>(A,B);
2339}
2340
2342inline bool operator>(const simatrix& A, const rmatrix_slice& B) {
2343 return spf_mm_greater<simatrix,rmatrix_slice,interval>(A,B);
2344}
2345
2347inline bool operator>(const simatrix& A, const imatrix_slice& B) {
2348 return spf_mm_greater<simatrix,imatrix_slice,interval>(A,B);
2349}
2350
2352inline bool operator>=(const simatrix& A, const srmatrix& B) {
2353 return spsp_mm_geq<simatrix,srmatrix,interval>(A,B);
2354}
2355
2357inline bool operator>=(const simatrix& A, const simatrix& B) {
2358 return spsp_mm_geq<simatrix,simatrix,interval>(A,B);
2359}
2360
2362inline bool operator>=(const simatrix& A, const rmatrix& B) {
2363 return spf_mm_geq<simatrix,rmatrix,interval>(A,B);
2364}
2365
2367inline bool operator>=(const simatrix& A, const imatrix& B) {
2368 return spf_mm_geq<simatrix,imatrix,interval>(A,B);
2369}
2370
2372inline bool operator>=(const imatrix& A, const srmatrix& B) {
2373 return fsp_mm_geq<imatrix,srmatrix,interval>(A,B);
2374}
2375
2377inline bool operator>=(const imatrix& A, const simatrix& B) {
2378 return fsp_mm_geq<imatrix,simatrix,interval>(A,B);
2379}
2380
2382inline bool operator>=(const imatrix_slice& A, const srmatrix& B) {
2383 return fsp_mm_geq<imatrix_slice,srmatrix,interval>(A,B);
2384}
2385
2387inline bool operator>=(const imatrix_slice& A, const simatrix& B) {
2388 return fsp_mm_geq<imatrix_slice,simatrix,interval>(A,B);
2389}
2390
2392inline bool operator>=(const simatrix& A, const rmatrix_slice& B) {
2393 return spf_mm_geq<simatrix,rmatrix_slice,interval>(A,B);
2394}
2395
2397inline bool operator>=(const simatrix& A, const imatrix_slice& B) {
2398 return spf_mm_geq<simatrix,imatrix_slice,interval>(A,B);
2399}
2400
2402inline bool operator!(const simatrix& A) {
2403 return sp_m_not(A);
2404}
2405
2407
2412inline std::ostream& operator<<(std::ostream& os, const simatrix& A) {
2413 return sp_m_output<simatrix,interval>(os,A);
2414}
2415
2417
2422inline std::istream& operator>>(std::istream& is, simatrix& A) {
2423 return sp_m_input<simatrix,interval>(is,A);
2424}
2425
2427
2432 public:
2433 simatrix A;
2434 simatrix* M; //Originalmatrix
2435
2436 private:
2437 simatrix_slice(simatrix& Mat, int sl1l, int sl1u, int sl2l, int sl2u) {
2438 A.lb1 = sl1l;
2439 A.lb2 = sl2l;
2440 A.ub1 = sl1u;
2441 A.ub2 = sl2u;
2442 A.m = sl1u-sl1l+1;
2443 A.n = sl2u-sl2l+1;
2444
2445 //Kopieren der Werte aus A
2446 A.p = std::vector<int>(A.n+1, 0);
2447 A.ind.reserve(A.m + A.n);
2448 A.x.reserve(A.m + A.n);
2449
2450 for(int i=0 ; i<A.n ; i++) {
2451 A.p[i+1] = A.p[i];
2452 for(int j=Mat.p[sl2l-Mat.lb2+i] ; j<Mat.p[sl2l-Mat.lb2+i+1] ; j++) {
2453 if(Mat.ind[j] >= sl1l-Mat.lb1 && Mat.ind[j] <= sl1u-Mat.lb1) {
2454 A.ind.push_back(Mat.ind[j]-(sl1l-Mat.lb1));
2455 A.x.push_back(Mat.x[j]);
2456 A.p[i+1]++;
2457 }
2458 }
2459 }
2460
2461 //Zeiger auf A fuer Datenmanipulationen
2462 M = &Mat;
2463 }
2464
2465 simatrix_slice(const simatrix& Mat, int sl1l, int sl1u, int sl2l, int sl2u) {
2466 A.lb1 = sl1l;
2467 A.lb2 = sl2l;
2468 A.ub1 = sl1u;
2469 A.ub2 = sl2u;
2470 A.m = sl1u-sl1l+1;
2471 A.n = sl2u-sl2l+1;
2472
2473 //Kopieren der Werte aus A
2474 A.p = std::vector<int>(A.n+1, 0);
2475 A.ind.reserve(A.m + A.n);
2476 A.x.reserve(A.m + A.n);
2477
2478 for(int i=0 ; i<A.n ; i++) {
2479 A.p[i+1] = A.p[i];
2480 for(int j=Mat.p[sl2l-Mat.lb2+i] ; j<Mat.p[sl2l-Mat.lb2+i+1] ; j++) {
2481 if(Mat.ind[j] >= sl1l-Mat.lb1 && Mat.ind[j] <= sl1u-Mat.lb1) {
2482 A.ind.push_back(Mat.ind[j]-(sl1l-Mat.lb1));
2483 A.x.push_back(Mat.x[j]);
2484 A.p[i+1]++;
2485 }
2486 }
2487 }
2488
2489 //Zeiger auf A fuer Datenmanipulationen
2490 M = const_cast<simatrix*>(&Mat); //Vorgehen noetig um Schreibweise A[i][j] bei auslesen von const A zu ermoeglichen
2491 }
2492
2493
2494 public:
2497 return sl_ms_assign<simatrix_slice, real, std::vector<interval>::iterator, interval>(*this,C);
2498 }
2499
2502 return sl_ms_assign<simatrix_slice, interval, std::vector<interval>::iterator, interval>(*this,C);
2503 }
2504
2507 return slsp_mm_assign<simatrix_slice, srmatrix, std::vector<interval>::iterator>(*this,C);
2508 }
2509
2512 return slsp_mm_assign<simatrix_slice, simatrix, std::vector<interval>::iterator>(*this,C);
2513 }
2514
2517 return slf_mm_assign<simatrix_slice, rmatrix, std::vector<interval>::iterator, interval>(*this,C);
2518 }
2519
2522 return slf_mm_assign<simatrix_slice, imatrix, std::vector<interval>::iterator, interval>(*this,C);
2523 }
2524
2527 return slf_mm_assign<simatrix_slice, rmatrix_slice, std::vector<interval>::iterator, interval>(*this,C);
2528 }
2529
2532 return slf_mm_assign<simatrix_slice, imatrix_slice, std::vector<interval>::iterator, interval>(*this,C);
2533 }
2534
2537 *this = C.A;
2538 return *this;
2539 }
2540
2543 *this = C.A;
2544 return *this;
2545 }
2546
2549 *this = A*M.A;
2550 return *this;
2551 }
2552
2555 *this = A*M.A;
2556 return *this;
2557 }
2558
2561 *this = A*M;
2562 return *this;
2563 }
2564
2567 *this = A*M;
2568 return *this;
2569 }
2570
2573 *this = A*M;
2574 return *this;
2575 }
2576
2579 *this = A*M;
2580 return *this;
2581 }
2582
2585 *this = A*M;
2586 return *this;
2587 }
2588
2591 *this = A*M;
2592 return *this;
2593 }
2594
2597 *this = A*r;
2598 return *this;
2599 }
2600
2603 *this = A*r;
2604 return *this;
2605 }
2606
2609 *this = A/r;
2610 return *this;
2611 }
2612
2615 *this = A/r;
2616 return *this;
2617 }
2618
2621 *this = A+M.A;
2622 return *this;
2623 }
2624
2627 *this = A+M.A;
2628 return *this;
2629 }
2630
2633 *this = A+M;
2634 return *this;
2635 }
2636
2639 *this = A+M;
2640 return *this;
2641 }
2642
2645 *this = A+M;
2646 return *this;
2647 }
2648
2651 *this = A+M;
2652 return *this;
2653 }
2654
2657 *this = A+M;
2658 return *this;
2659 }
2660
2663 *this = A+M;
2664 return *this;
2665 }
2666
2669 *this = A-M.A;
2670 return *this;
2671 }
2672
2675 *this = A-M.A;
2676 return *this;
2677 }
2678
2681 *this = A-M;
2682 return *this;
2683 }
2684
2687 *this = A-M;
2688 return *this;
2689 }
2690
2693 *this = A-M;
2694 return *this;
2695 }
2696
2699 *this = A-M;
2700 return *this;
2701 }
2702
2705 *this = A-M;
2706 return *this;
2707 }
2708
2711 *this = A-M;
2712 return *this;
2713 }
2714
2717 *this = A|M.A;
2718 return *this;
2719 }
2720
2723 *this = A|M.A;
2724 return *this;
2725 }
2726
2729 *this = A|M;
2730 return *this;
2731 }
2732
2735 *this = A|M;
2736 return *this;
2737 }
2738
2741 *this = A|M;
2742 return *this;
2743 }
2744
2747 *this = A|M;
2748 return *this;
2749 }
2750
2753 *this = A|M;
2754 return *this;
2755 }
2756
2759 *this = A|M;
2760 return *this;
2761 }
2762
2764
2768 const interval operator()(const int i, const int j) const {
2769#if(CXSC_INDEX_CHECK)
2770 if(i<A.lb1 || i>A.ub1 || j<A.lb2 || j>A.ub2)
2771 cxscthrow(ELEMENT_NOT_IN_VEC("simatrix_slice::operator()(int, int)"));
2772#endif
2773 interval r = A(i,j);
2774 return r;
2775 }
2776
2778
2782 interval& element(const int i, const int j) {
2783#if(CXSC_INDEX_CHECK)
2784 if(i<A.lb1 || i>A.ub1 || j<A.lb2 || j>A.ub2)
2785 cxscthrow(ELEMENT_NOT_IN_VEC("simatrix_slice::element(int, int)"));
2786#endif
2787 return M->element(i,j);
2788 }
2789
2791 simatrix_subv operator[](const int);
2793 simatrix_subv operator[](const cxscmatrix_column&);
2795 const simatrix_subv operator[](const int) const;
2797 const simatrix_subv operator[](const cxscmatrix_column&) const;
2798
2799 friend std::ostream& operator<<(std::ostream&, const simatrix_slice&);
2800
2801 friend int Lb(const simatrix_slice&, const int);
2802 friend int Ub(const simatrix_slice&, const int);
2803 friend srmatrix Inf(const simatrix_slice&);
2804 friend srmatrix Sup(const simatrix_slice&);
2805 friend simatrix abs(const simatrix_slice&);
2806 friend srmatrix mid(const simatrix_slice&);
2807 friend srmatrix diam(const simatrix_slice&);
2808 friend int RowLen(const simatrix_slice&);
2809 friend int ColLen(const simatrix_slice&);
2810
2811 friend class srmatrix;
2812 friend class srmatrix_subv;
2813 friend class srvector;
2814 friend class simatrix;
2815 friend class simatrix_subv;
2816 friend class sivector;
2817 friend class scimatrix;
2818 friend class scimatrix_subv;
2819 friend class scimatrix_slice;
2820 friend class scivector;
2821 friend class imatrix;
2822 friend class cimatrix;
2823
2824
2825#include "matrix_friend_declarations.inl"
2826};
2827
2829 dat = new interval[A.A.m*A.A.n];
2830 lb1 = A.A.lb1; lb2 = A.A.lb2; ub1 = A.A.ub1; ub2 = A.A.ub2;
2831 xsize = A.A.n;
2832 ysize = A.A.m;
2833 *this = 0.0;
2834 for(int j=0 ; j<A.A.n ; j++) {
2835 for(int k=A.A.p[j] ; k<A.A.p[j+1] ; k++) {
2836 dat[A.A.ind[k]*A.A.n+j] = A.A.x[k];
2837 }
2838 }
2839}
2840
2842 dat = new interval[A.A.m*A.A.n];
2843 lb1 = A.A.lb1; lb2 = A.A.lb2; ub1 = A.A.ub1; ub2 = A.A.ub2;
2844 xsize = A.A.n;
2845 ysize = A.A.m;
2846 *this = 0.0;
2847 for(int j=0 ; j<A.A.n ; j++) {
2848 for(int k=A.A.p[j] ; k<A.A.p[j+1] ; k++) {
2849 dat[A.A.ind[k]*A.A.n+j] = A.A.x[k];
2850 }
2851 }
2852}
2853
2855inline int RowLen(const simatrix_slice& S) {
2856 return RowLen(S.A);
2857}
2858
2860inline int ColLen(const simatrix_slice& S) {
2861 return ColLen(S.A);
2862}
2863
2864inline simatrix_slice simatrix::operator()(const int i, const int j, const int k, const int l) {
2865#if(CXSC_INDEX_CHECK)
2866 if(i<lb1 || j>ub1 || k<lb2 || l>ub2)
2867 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator()(int, int, int, int)"));
2868#endif
2869 return simatrix_slice(*this, i, j, k, l);
2870}
2871
2872inline const simatrix_slice simatrix::operator()(const int i, const int j, const int k, const int l) const {
2873#if(CXSC_INDEX_CHECK)
2874 if(i<lb1 || j>ub1 || k<lb2 || l>ub2)
2875 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator()(int, int, int, int) const"));
2876#endif
2877 return simatrix_slice(*this, i, j, k, l);
2878}
2879
2881inline int Lb(const simatrix_slice& S, const int i) {
2882 return Lb(S.A, i);
2883}
2884
2886inline int Ub(const simatrix_slice& S, const int i) {
2887 return Ub(S.A, i);
2888}
2889
2891inline srmatrix Inf(const simatrix_slice& S) {
2892 return Inf(S.A);
2893}
2894
2896inline srmatrix Sup(const simatrix_slice& S) {
2897 return Sup(S.A);
2898}
2899
2901inline simatrix abs(const simatrix_slice& S) {
2902 return abs(S.A);
2903}
2904
2906inline srmatrix mid(const simatrix_slice& S) {
2907 return mid(S.A);
2908}
2909
2911inline srmatrix diam(const simatrix_slice& S) {
2912 return diam(S.A);
2913}
2914
2916 m = S.A.m;
2917 n = S.A.n;
2918 lb1 = S.A.lb1;
2919 ub1 = S.A.ub1;
2920 lb2 = S.A.lb2;
2921 ub2 = S.A.ub2;
2922 *this = S.A;
2923}
2924
2926 m = S.A.m;
2927 n = S.A.n;
2928 lb1 = S.A.lb1;
2929 ub1 = S.A.ub1;
2930 lb2 = S.A.lb2;
2931 ub2 = S.A.ub2;
2932 *this = S.A;
2933}
2934
2936 *this = S.A;
2937 return *this;
2938}
2939
2941 *this = S.A;
2942 return *this;
2943}
2944
2946 *this = rmatrix(M);
2947 return *this;
2948}
2949
2951 *this = imatrix(M);
2952 return *this;
2953}
2954
2956 *this += M.A;
2957 return *this;
2958}
2959
2961 *this += M.A;
2962 return *this;
2963}
2964
2966 *this += M.A;
2967 return *this;
2968}
2969
2971 *this += M.A;
2972 return *this;
2973}
2974
2976 *this -= M.A;
2977 return *this;
2978}
2979
2981 *this -= M.A;
2982 return *this;
2983}
2984
2986 *this -= M.A;
2987 return *this;
2988}
2989
2991 *this -= M.A;
2992 return *this;
2993}
2994
2996 *this *= M.A;
2997 return *this;
2998}
2999
3001 *this *= M.A;
3002 return *this;
3003}
3004
3006 *this *= M.A;
3007 return *this;
3008}
3009
3011 *this *= M.A;
3012 return *this;
3013}
3014
3016 *this |= M.A;
3017 return *this;
3018}
3019
3021 *this |= M.A;
3022 return *this;
3023}
3024
3026 *this |= M.A;
3027 return *this;
3028}
3029
3031 *this |= M.A;
3032 return *this;
3033}
3034
3036 *this &= M.A;
3037 return *this;
3038}
3039
3041 *this &= M.A;
3042 return *this;
3043}
3044
3046 *this &= M.A;
3047 return *this;
3048}
3049
3051 *this &= M.A;
3052 return *this;
3053}
3054
3056inline simatrix operator-(const simatrix_slice& M) {
3057 return sp_m_negative<simatrix,simatrix>(M.A);
3058}
3059
3061inline simatrix operator+(const simatrix_slice& M) {
3062 return M.A;
3063}
3064
3066
3072inline simatrix operator*(const simatrix_slice& M1, const srmatrix_slice& M2) {
3073 return spsp_mm_mult<simatrix,srmatrix,simatrix,sparse_idot,interval>(M1.A,M2.A);
3074}
3075
3077
3083inline simatrix operator*(const srmatrix_slice& M1, const simatrix_slice& M2) {
3084 return spsp_mm_mult<srmatrix,simatrix,simatrix,sparse_idot,interval>(M1.A,M2.A);
3085}
3086
3088
3094inline simatrix operator*(const simatrix_slice& M1, const simatrix_slice& M2) {
3095 return spsp_mm_mult<simatrix,simatrix,simatrix,sparse_idot,interval>(M1.A,M2.A);
3096}
3097
3099
3105inline simatrix operator*(const simatrix_slice& M1, const srmatrix& M2) {
3106 return spsp_mm_mult<simatrix,srmatrix,simatrix,sparse_idot,interval>(M1.A,M2);
3107}
3108
3110
3116inline simatrix operator*(const srmatrix_slice& M1, const simatrix& M2) {
3117 return spsp_mm_mult<srmatrix,simatrix,simatrix,sparse_idot,interval>(M1.A,M2);
3118}
3119
3121
3127inline simatrix operator*(const simatrix_slice& M1, const simatrix& M2) {
3128 return spsp_mm_mult<simatrix,simatrix,simatrix,sparse_idot,interval>(M1.A,M2);
3129}
3130
3132
3138inline simatrix operator*(const simatrix& M1, const srmatrix_slice& M2) {
3139 return spsp_mm_mult<simatrix,srmatrix,simatrix,sparse_idot,interval>(M1,M2.A);
3140}
3141
3143
3149inline simatrix operator*(const srmatrix& M1, const simatrix_slice& M2) {
3150 return spsp_mm_mult<srmatrix,simatrix,simatrix,sparse_idot,interval>(M1,M2.A);
3151}
3152
3154
3160inline simatrix operator*(const simatrix& M1, const simatrix_slice& M2) {
3161 return spsp_mm_mult<simatrix,simatrix,simatrix,sparse_idot,interval>(M1,M2.A);
3162}
3163
3165
3171inline imatrix operator*(const simatrix_slice& M1, const rmatrix& M2) {
3172 return spf_mm_mult<simatrix,rmatrix,imatrix,sparse_idot>(M1.A,M2);
3173}
3174
3176
3182inline imatrix operator*(const srmatrix_slice& M1, const imatrix& M2) {
3183 return spf_mm_mult<srmatrix,imatrix,imatrix,sparse_idot>(M1.A,M2);
3184}
3185
3187
3193inline imatrix operator*(const simatrix_slice& M1, const imatrix& M2) {
3194 return spf_mm_mult<simatrix,imatrix,imatrix,sparse_idot>(M1.A,M2);
3195}
3196
3198
3204inline imatrix operator*(const imatrix& M1, const srmatrix_slice& M2) {
3205 return fsp_mm_mult<imatrix,srmatrix,imatrix,sparse_idot>(M1,M2.A);
3206}
3207
3209
3215inline imatrix operator*(const rmatrix& M1, const simatrix_slice& M2) {
3216 return fsp_mm_mult<rmatrix,simatrix,imatrix,sparse_idot>(M1,M2.A);
3217}
3218
3220
3226inline imatrix operator*(const imatrix& M1, const simatrix_slice& M2) {
3227 return fsp_mm_mult<imatrix,simatrix,imatrix,sparse_idot>(M1,M2.A);
3228}
3229
3231
3237inline imatrix operator*(const simatrix_slice& M1, const rmatrix_slice& M2) {
3238 return spf_mm_mult<simatrix,rmatrix_slice,imatrix,sparse_idot>(M1.A,M2);
3239}
3240
3242
3248inline imatrix operator*(const srmatrix_slice& M1, const imatrix_slice& M2) {
3249 return spf_mm_mult<srmatrix,imatrix_slice,imatrix,sparse_idot>(M1.A,M2);
3250}
3251
3253
3259inline imatrix operator*(const simatrix_slice& M1, const imatrix_slice& M2) {
3260 return spf_mm_mult<simatrix,imatrix_slice,imatrix,sparse_idot>(M1.A,M2);
3261}
3262
3264
3270inline imatrix operator*(const imatrix_slice& M1, const srmatrix_slice& M2) {
3271 return fsp_mm_mult<imatrix,srmatrix,imatrix,sparse_idot>(M1,M2.A);
3272}
3273
3275
3281inline imatrix operator*(const rmatrix_slice& M1, const simatrix_slice& M2) {
3282 return fsp_mm_mult<rmatrix,simatrix,imatrix,sparse_idot>(M1,M2.A);
3283}
3284
3286
3292inline imatrix operator*(const imatrix_slice& M1, const simatrix_slice& M2) {
3293 return fsp_mm_mult<imatrix,simatrix,imatrix,sparse_idot>(M1,M2.A);
3294}
3295
3297
3303inline sivector operator*(const simatrix_slice& M, const srvector& v) {
3304 return spsp_mv_mult<simatrix,srvector,sivector,sparse_idot,interval>(M.A,v);
3305}
3306
3308
3314inline sivector operator*(const srmatrix_slice& M, const sivector& v) {
3315 return spsp_mv_mult<srmatrix,sivector,sivector,sparse_idot,interval>(M.A,v);
3316}
3317
3319
3325inline sivector operator*(const simatrix_slice& M, const sivector& v) {
3326 return spsp_mv_mult<simatrix,sivector,sivector,sparse_idot,interval>(M.A,v);
3327}
3328
3330
3337 return spsl_mv_mult<simatrix,srvector_slice,sivector,sparse_idot,interval>(M.A,v);
3338}
3339
3341
3348 return spsl_mv_mult<srmatrix,sivector_slice,sivector,sparse_idot,interval>(M.A,v);
3349}
3350
3352
3359 return spsl_mv_mult<simatrix,sivector_slice,sivector,sparse_idot,interval>(M.A,v);
3360}
3361
3363
3369inline ivector operator*(const simatrix_slice& M, const rvector& v) {
3370 return spf_mv_mult<simatrix,rvector,ivector,sparse_idot>(M.A,v);
3371}
3372
3374
3380inline ivector operator*(const srmatrix_slice& M, const ivector& v) {
3381 return spf_mv_mult<srmatrix,ivector,ivector,sparse_idot>(M.A,v);
3382}
3383
3385
3391inline ivector operator*(const simatrix_slice& M, const ivector& v) {
3392 return spf_mv_mult<simatrix,ivector,ivector,sparse_idot>(M.A,v);
3393}
3394
3396
3402inline ivector operator*(const simatrix_slice& M, const rvector_slice& v) {
3403 return spf_mv_mult<simatrix,rvector_slice,ivector,sparse_idot>(M.A,v);
3404}
3405
3407
3413inline ivector operator*(const srmatrix_slice& M, const ivector_slice& v) {
3414 return spf_mv_mult<srmatrix,ivector_slice,ivector,sparse_idot>(M.A,v);
3415}
3416
3418
3424inline ivector operator*(const simatrix_slice& M, const ivector_slice& v) {
3425 return spf_mv_mult<simatrix,ivector_slice,ivector,sparse_idot>(M.A,v);
3426}
3427
3429inline simatrix operator/(const simatrix_slice& M, const real& r) {
3430 return sp_ms_div<simatrix,real,simatrix>(M.A,r);
3431}
3432
3434inline simatrix operator/(const simatrix_slice& M, const interval& r) {
3435 return sp_ms_div<simatrix,interval,simatrix>(M.A,r);
3436}
3437
3439inline simatrix operator/(const srmatrix_slice& M, const interval& r) {
3440 return sp_ms_div<srmatrix,interval,simatrix>(M.A,r);
3441}
3442
3444inline simatrix operator*(const simatrix_slice& M, const real& r) {
3445 return sp_ms_mult<simatrix,real,simatrix>(M.A,r);
3446}
3447
3449inline simatrix operator*(const simatrix_slice& M, const interval& r) {
3450 return sp_ms_mult<simatrix,interval,simatrix>(M.A,r);
3451}
3452
3454inline simatrix operator*(const srmatrix_slice& M, const interval& r) {
3455 return sp_ms_mult<srmatrix,interval,simatrix>(M.A,r);
3456}
3457
3459inline simatrix operator*(const real& r, const simatrix_slice& M) {
3460 return sp_sm_mult<real,simatrix,simatrix>(r,M.A);
3461}
3462
3464inline simatrix operator*(const interval& r, const srmatrix_slice& M) {
3465 return sp_sm_mult<interval,srmatrix,simatrix>(r,M.A);
3466}
3467
3469inline simatrix operator*(const interval& r, const simatrix_slice& M) {
3470 return sp_sm_mult<interval,simatrix,simatrix>(r,M.A);
3471}
3472
3474inline simatrix operator+(const simatrix_slice& M1, const srmatrix_slice& M2) {
3475 return spsp_mm_add<simatrix,srmatrix,simatrix,interval>(M1.A,M2.A);
3476}
3477
3479inline simatrix operator+(const srmatrix_slice& M1, const simatrix_slice& M2) {
3480 return spsp_mm_add<srmatrix,simatrix,simatrix,interval>(M1.A,M2.A);
3481}
3482
3484inline simatrix operator+(const simatrix_slice& M1, const simatrix_slice& M2) {
3485 return spsp_mm_add<simatrix,simatrix,simatrix,interval>(M1.A,M2.A);
3486}
3487
3489inline simatrix operator+(const simatrix_slice& M1, const srmatrix& M2) {
3490 return spsp_mm_add<simatrix,srmatrix,simatrix,interval>(M1.A,M2);
3491}
3492
3494inline simatrix operator+(const srmatrix_slice& M1, const simatrix& M2) {
3495 return spsp_mm_add<srmatrix,simatrix,simatrix,interval>(M1.A,M2);
3496}
3497
3499inline simatrix operator+(const simatrix_slice& M1, const simatrix& M2) {
3500 return spsp_mm_add<simatrix,simatrix,simatrix,interval>(M1.A,M2);
3501}
3502
3504inline simatrix operator+(const simatrix& M1, const srmatrix_slice& M2) {
3505 return spsp_mm_add<simatrix,srmatrix,simatrix,interval>(M1,M2.A);
3506}
3507
3509inline simatrix operator+(const srmatrix& M1, const simatrix_slice& M2) {
3510 return spsp_mm_add<srmatrix,simatrix,simatrix,interval>(M1,M2.A);
3511}
3512
3514inline simatrix operator+(const simatrix& M1, const simatrix_slice& M2) {
3515 return spsp_mm_add<simatrix,simatrix,simatrix,interval>(M1,M2.A);
3516}
3517
3519inline imatrix operator+(const simatrix_slice& M1, const rmatrix& M2) {
3520 return spf_mm_add<simatrix,rmatrix,imatrix>(M1.A,M2);
3521}
3522
3524inline imatrix operator+(const srmatrix_slice& M1, const imatrix& M2) {
3525 return spf_mm_add<srmatrix,imatrix,imatrix>(M1.A,M2);
3526}
3527
3529inline imatrix operator+(const simatrix_slice& M1, const imatrix& M2) {
3530 return spf_mm_add<simatrix,imatrix,imatrix>(M1.A,M2);
3531}
3532
3534inline imatrix operator+(const imatrix& M1, const srmatrix_slice& M2) {
3535 return fsp_mm_add<imatrix,srmatrix,imatrix>(M1,M2.A);
3536}
3537
3539inline imatrix operator+(const rmatrix& M1, const simatrix_slice& M2) {
3540 return fsp_mm_add<rmatrix,simatrix,imatrix>(M1,M2.A);
3541}
3542
3544inline imatrix operator+(const imatrix& M1, const simatrix_slice& M2) {
3545 return fsp_mm_add<imatrix,simatrix,imatrix>(M1,M2.A);
3546}
3547
3549inline imatrix operator+(const simatrix_slice& M1, const rmatrix_slice& M2) {
3550 return spf_mm_add<simatrix,rmatrix_slice,imatrix>(M1.A,M2);
3551}
3552
3554inline imatrix operator+(const srmatrix_slice& M1, const imatrix_slice& M2) {
3555 return spf_mm_add<srmatrix,imatrix_slice,imatrix>(M1.A,M2);
3556}
3557
3559inline imatrix operator+(const simatrix_slice& M1, const imatrix_slice& M2) {
3560 return spf_mm_add<simatrix,imatrix_slice,imatrix>(M1.A,M2);
3561}
3562
3564inline imatrix operator+(const imatrix_slice& M1, const srmatrix_slice& M2) {
3565 return fsp_mm_add<imatrix_slice,srmatrix,imatrix>(M1,M2.A);
3566}
3567
3569inline imatrix operator+(const rmatrix_slice& M1, const simatrix_slice& M2) {
3570 return fsp_mm_add<rmatrix_slice,simatrix,imatrix>(M1,M2.A);
3571}
3572
3574inline imatrix operator+(const imatrix_slice& M1, const simatrix_slice& M2) {
3575 return fsp_mm_add<imatrix_slice,simatrix,imatrix>(M1,M2.A);
3576}
3577
3579inline simatrix operator-(const simatrix_slice& M1, const srmatrix_slice& M2) {
3580 return spsp_mm_sub<simatrix,srmatrix,simatrix,interval>(M1.A,M2.A);
3581}
3582
3584inline simatrix operator-(const srmatrix_slice& M1, const simatrix_slice& M2) {
3585 return spsp_mm_sub<srmatrix,simatrix,simatrix,interval>(M1.A,M2.A);
3586}
3587
3589inline simatrix operator-(const simatrix_slice& M1, const simatrix_slice& M2) {
3590 return spsp_mm_sub<simatrix,simatrix,simatrix,interval>(M1.A,M2.A);
3591}
3592
3594inline simatrix operator-(const simatrix_slice& M1, const srmatrix& M2) {
3595 return spsp_mm_sub<simatrix,srmatrix,simatrix,interval>(M1.A,M2);
3596}
3597
3599inline simatrix operator-(const srmatrix_slice& M1, const simatrix& M2) {
3600 return spsp_mm_sub<srmatrix,simatrix,simatrix,interval>(M1.A,M2);
3601}
3602
3604inline simatrix operator-(const simatrix_slice& M1, const simatrix& M2) {
3605 return spsp_mm_sub<simatrix,simatrix,simatrix,interval>(M1.A,M2);
3606}
3607
3609inline simatrix operator-(const simatrix& M1, const srmatrix_slice& M2) {
3610 return spsp_mm_sub<simatrix,srmatrix,simatrix,interval>(M1,M2.A);
3611}
3612
3614inline simatrix operator-(const srmatrix& M1, const simatrix_slice& M2) {
3615 return spsp_mm_sub<srmatrix,simatrix,simatrix,interval>(M1,M2.A);
3616}
3617
3619inline simatrix operator-(const simatrix& M1, const simatrix_slice& M2) {
3620 return spsp_mm_sub<simatrix,simatrix,simatrix,interval>(M1,M2.A);
3621}
3622
3624inline imatrix operator-(const simatrix_slice& M1, const rmatrix& M2) {
3625 return spf_mm_sub<simatrix,rmatrix,imatrix>(M1.A,M2);
3626}
3627
3629inline imatrix operator-(const srmatrix_slice& M1, const imatrix& M2) {
3630 return spf_mm_sub<srmatrix,imatrix,imatrix>(M1.A,M2);
3631}
3632
3634inline imatrix operator-(const simatrix_slice& M1, const imatrix& M2) {
3635 return spf_mm_sub<simatrix,imatrix,imatrix>(M1.A,M2);
3636}
3637
3639inline imatrix operator-(const imatrix& M1, const srmatrix_slice& M2) {
3640 return fsp_mm_sub<imatrix,srmatrix,imatrix>(M1,M2.A);
3641}
3642
3644inline imatrix operator-(const rmatrix& M1, const simatrix_slice& M2) {
3645 return fsp_mm_sub<rmatrix,simatrix,imatrix>(M1,M2.A);
3646}
3647
3649inline imatrix operator-(const imatrix& M1, const simatrix_slice& M2) {
3650 return fsp_mm_sub<imatrix,simatrix,imatrix>(M1,M2.A);
3651}
3652
3654inline imatrix operator-(const simatrix_slice& M1, const rmatrix_slice& M2) {
3655 return spf_mm_sub<simatrix,rmatrix_slice,imatrix>(M1.A,M2);
3656}
3657
3659inline imatrix operator-(const srmatrix_slice& M1, const imatrix_slice& M2) {
3660 return spf_mm_sub<srmatrix,imatrix_slice,imatrix>(M1.A,M2);
3661}
3662
3664inline imatrix operator-(const simatrix_slice& M1, const imatrix_slice& M2) {
3665 return spf_mm_sub<simatrix,imatrix_slice,imatrix>(M1.A,M2);
3666}
3667
3669inline imatrix operator-(const imatrix_slice& M1, const srmatrix_slice& M2) {
3670 return fsp_mm_sub<imatrix_slice,srmatrix,imatrix>(M1,M2.A);
3671}
3672
3674inline imatrix operator-(const rmatrix_slice& M1, const simatrix_slice& M2) {
3675 return fsp_mm_sub<rmatrix_slice,simatrix,imatrix>(M1,M2.A);
3676}
3677
3679inline imatrix operator-(const imatrix_slice& M1, const simatrix_slice& M2) {
3680 return fsp_mm_sub<imatrix_slice,simatrix,imatrix>(M1,M2.A);
3681}
3682
3684inline simatrix operator|(const simatrix_slice& M1, const srmatrix_slice& M2) {
3685 return spsp_mm_hull<simatrix,srmatrix,simatrix,interval>(M1.A,M2.A);
3686}
3687
3689inline simatrix operator|(const srmatrix_slice& M1, const simatrix_slice& M2) {
3690 return spsp_mm_hull<srmatrix,simatrix,simatrix,interval>(M1.A,M2.A);
3691}
3692
3694inline simatrix operator|(const simatrix_slice& M1, const simatrix_slice& M2) {
3695 return spsp_mm_hull<simatrix,simatrix,simatrix,interval>(M1.A,M2.A);
3696}
3697
3699inline simatrix operator|(const simatrix_slice& M1, const srmatrix& M2) {
3700 return spsp_mm_hull<simatrix,srmatrix,simatrix,interval>(M1.A,M2);
3701}
3702
3704inline simatrix operator|(const srmatrix_slice& M1, const simatrix& M2) {
3705 return spsp_mm_hull<srmatrix,simatrix,simatrix,interval>(M1.A,M2);
3706}
3707
3709inline simatrix operator|(const simatrix_slice& M1, const simatrix& M2) {
3710 return spsp_mm_hull<simatrix,simatrix,simatrix,interval>(M1.A,M2);
3711}
3712
3714inline simatrix operator|(const simatrix& M1, const srmatrix_slice& M2) {
3715 return spsp_mm_hull<simatrix,srmatrix,simatrix,interval>(M1,M2.A);
3716}
3717
3719inline simatrix operator|(const srmatrix& M1, const simatrix_slice& M2) {
3720 return spsp_mm_hull<srmatrix,simatrix,simatrix,interval>(M1,M2.A);
3721}
3722
3724inline simatrix operator|(const simatrix& M1, const simatrix_slice& M2) {
3725 return spsp_mm_hull<simatrix,simatrix,simatrix,interval>(M1,M2.A);
3726}
3727
3729inline imatrix operator|(const simatrix_slice& M1, const rmatrix& M2) {
3730 return spf_mm_hull<simatrix,rmatrix,imatrix>(M1.A,M2);
3731}
3732
3734inline imatrix operator|(const srmatrix_slice& M1, const imatrix& M2) {
3735 return spf_mm_hull<srmatrix,imatrix,imatrix>(M1.A,M2);
3736}
3737
3739inline imatrix operator|(const simatrix_slice& M1, const imatrix& M2) {
3740 return spf_mm_hull<simatrix,imatrix,imatrix>(M1.A,M2);
3741}
3742
3744inline imatrix operator|(const imatrix& M1, const srmatrix_slice& M2) {
3745 return fsp_mm_hull<imatrix,srmatrix,imatrix>(M1,M2.A);
3746}
3747
3749inline imatrix operator|(const rmatrix& M1, const simatrix_slice& M2) {
3750 return fsp_mm_hull<rmatrix,simatrix,imatrix>(M1,M2.A);
3751}
3752
3754inline imatrix operator|(const imatrix& M1, const simatrix_slice& M2) {
3755 return fsp_mm_hull<imatrix,simatrix,imatrix>(M1,M2.A);
3756}
3757
3759inline imatrix operator|(const simatrix_slice& M1, const rmatrix_slice& M2) {
3760 return spf_mm_hull<simatrix,rmatrix_slice,imatrix>(M1.A,M2);
3761}
3762
3764inline imatrix operator|(const srmatrix_slice& M1, const imatrix_slice& M2) {
3765 return spf_mm_hull<srmatrix,imatrix_slice,imatrix>(M1.A,M2);
3766}
3767
3769inline imatrix operator|(const simatrix_slice& M1, const imatrix_slice& M2) {
3770 return spf_mm_hull<simatrix,imatrix_slice,imatrix>(M1.A,M2);
3771}
3772
3774inline imatrix operator|(const imatrix_slice& M1, const srmatrix_slice& M2) {
3775 return fsp_mm_hull<imatrix_slice,srmatrix,imatrix>(M1,M2.A);
3776}
3777
3779inline imatrix operator|(const rmatrix_slice& M1, const simatrix_slice& M2) {
3780 return fsp_mm_hull<rmatrix_slice,simatrix,imatrix>(M1,M2.A);
3781}
3782
3784inline imatrix operator|(const imatrix_slice& M1, const simatrix_slice& M2) {
3785 return fsp_mm_hull<imatrix_slice,simatrix,imatrix>(M1,M2.A);
3786}
3787
3789inline simatrix operator|(const srmatrix_slice& M1, const srmatrix_slice& M2) {
3790 return spsp_mm_hull<srmatrix,srmatrix,simatrix,interval>(M1.A,M2.A);
3791}
3792
3794inline simatrix operator|(const srmatrix_slice& M1, const srmatrix& M2) {
3795 return spsp_mm_hull<srmatrix,srmatrix,simatrix,interval>(M1.A,M2);
3796}
3797
3799inline simatrix operator|(const srmatrix& M1, const srmatrix_slice& M2) {
3800 return spsp_mm_hull<srmatrix,srmatrix,simatrix,interval>(M1,M2.A);
3801}
3802
3804inline imatrix operator|(const srmatrix_slice& M1, const rmatrix& M2) {
3805 return spf_mm_hull<srmatrix,rmatrix,imatrix>(M1.A,M2);
3806}
3807
3809inline imatrix operator|(const rmatrix& M1, const srmatrix_slice& M2) {
3810 return fsp_mm_hull<rmatrix,srmatrix,imatrix>(M1,M2.A);
3811}
3812
3814inline imatrix operator|(const srmatrix_slice& M1, const rmatrix_slice& M2) {
3815 return spf_mm_hull<srmatrix,rmatrix_slice,imatrix>(M1.A,M2);
3816}
3817
3819inline imatrix operator|(const rmatrix_slice& M1, const srmatrix_slice& M2) {
3820 return fsp_mm_hull<rmatrix_slice,srmatrix,imatrix>(M1,M2.A);
3821}
3822
3824inline simatrix operator&(const simatrix_slice& M1, const simatrix_slice& M2) {
3825 return spsp_mm_intersect<simatrix,simatrix,simatrix,interval>(M1.A,M2.A);
3826}
3827
3829inline simatrix operator&(const simatrix_slice& M1, const simatrix& M2) {
3830 return spsp_mm_intersect<simatrix,simatrix,simatrix,interval>(M1.A,M2);
3831}
3832
3834inline simatrix operator&(const simatrix& M1, const simatrix_slice& M2) {
3835 return spsp_mm_intersect<simatrix,simatrix,simatrix,interval>(M1,M2.A);
3836}
3837
3839inline imatrix operator&(const simatrix_slice& M1, const imatrix& M2) {
3840 return spf_mm_intersect<simatrix,imatrix,imatrix>(M1.A,M2);
3841}
3842
3844inline imatrix operator&(const imatrix& M1, const simatrix_slice& M2) {
3845 return fsp_mm_intersect<imatrix,simatrix,imatrix>(M1,M2.A);
3846}
3847
3849inline imatrix operator&(const simatrix_slice& M1, const imatrix_slice& M2) {
3850 return spf_mm_intersect<simatrix,imatrix_slice,imatrix>(M1.A,M2);
3851}
3852
3854inline imatrix operator&(const imatrix_slice& M1, const simatrix_slice& M2) {
3855 return fsp_mm_intersect<imatrix_slice,simatrix,imatrix>(M1,M2.A);
3856}
3857
3859inline bool operator==(const simatrix_slice& M1, const srmatrix_slice& M2) {
3860 return spsp_mm_comp(M1.A,M2.A);
3861}
3862
3864inline bool operator==(const srmatrix_slice& M1, const simatrix_slice& M2) {
3865 return spsp_mm_comp(M1.A,M2.A);
3866}
3867
3869inline bool operator==(const simatrix_slice& M1, const simatrix_slice& M2) {
3870 return spsp_mm_comp(M1.A,M2.A);
3871}
3872
3874inline bool operator==(const simatrix_slice& M1, const srmatrix& M2) {
3875 return spsp_mm_comp(M1.A,M2);
3876}
3877
3879inline bool operator==(const srmatrix_slice& M1, const simatrix& M2) {
3880 return spsp_mm_comp(M1.A,M2);
3881}
3882
3884inline bool operator==(const simatrix_slice& M1, const simatrix& M2) {
3885 return spsp_mm_comp(M1.A,M2);
3886}
3887
3889inline bool operator==(const simatrix& M1, const srmatrix_slice& M2) {
3890 return spsp_mm_comp(M1,M2.A);
3891}
3892
3894inline bool operator==(const srmatrix& M1, const simatrix_slice& M2) {
3895 return spsp_mm_comp(M1,M2.A);
3896}
3897
3899inline bool operator==(const simatrix& M1, const simatrix_slice& M2) {
3900 return spsp_mm_comp(M1,M2.A);
3901}
3902
3904inline bool operator==(const simatrix_slice& M1, const rmatrix& M2) {
3905 return spf_mm_comp(M1.A,M2);
3906}
3907
3909inline bool operator==(const srmatrix_slice& M1, const imatrix& M2) {
3910 return spf_mm_comp(M1.A,M2);
3911}
3912
3914inline bool operator==(const simatrix_slice& M1, const imatrix& M2) {
3915 return spf_mm_comp(M1.A,M2);
3916}
3917
3919inline bool operator==(const imatrix& M1, const srmatrix_slice& M2) {
3920 return fsp_mm_comp(M1,M2.A);
3921}
3922
3924inline bool operator==(const rmatrix& M1, const simatrix_slice& M2) {
3925 return fsp_mm_comp(M1,M2.A);
3926}
3927
3929inline bool operator==(const imatrix& M1, const simatrix_slice& M2) {
3930 return fsp_mm_comp(M1,M2.A);
3931}
3932
3934inline bool operator==(const imatrix_slice& M1, const srmatrix_slice& M2) {
3935 return fsp_mm_comp(M1,M2.A);
3936}
3937
3939inline bool operator==(const rmatrix_slice& M1, const simatrix_slice& M2) {
3940 return fsp_mm_comp(M1,M2.A);
3941}
3942
3944inline bool operator==(const imatrix_slice& M1, const simatrix_slice& M2) {
3945 return fsp_mm_comp(M1,M2.A);
3946}
3947
3949inline bool operator==(const simatrix_slice& M1, const rmatrix_slice& M2) {
3950 return spf_mm_comp(M1.A,M2);
3951}
3952
3954inline bool operator==(const srmatrix_slice& M1, const imatrix_slice& M2) {
3955 return spf_mm_comp(M1.A,M2);
3956}
3957
3959inline bool operator==(const simatrix_slice& M1, const imatrix_slice& M2) {
3960 return spf_mm_comp(M1.A,M2);
3961}
3962
3964inline bool operator!=(const simatrix_slice& M1, const srmatrix_slice& M2) {
3965 return !spsp_mm_comp(M1.A,M2.A);
3966}
3967
3969inline bool operator!=(const srmatrix_slice& M1, const simatrix_slice& M2) {
3970 return !spsp_mm_comp(M1.A,M2.A);
3971}
3972
3974inline bool operator!=(const simatrix_slice& M1, const simatrix_slice& M2) {
3975 return !spsp_mm_comp(M1.A,M2.A);
3976}
3977
3979inline bool operator!=(const simatrix_slice& M1, const srmatrix& M2) {
3980 return !spsp_mm_comp(M1.A,M2);
3981}
3982
3984inline bool operator!=(const srmatrix_slice& M1, const simatrix& M2) {
3985 return !spsp_mm_comp(M1.A,M2);
3986}
3987
3989inline bool operator!=(const simatrix_slice& M1, const simatrix& M2) {
3990 return !spsp_mm_comp(M1.A,M2);
3991}
3992
3994inline bool operator!=(const simatrix& M1, const srmatrix_slice& M2) {
3995 return !spsp_mm_comp(M1,M2.A);
3996}
3997
3999inline bool operator!=(const srmatrix& M1, const simatrix_slice& M2) {
4000 return !spsp_mm_comp(M1,M2.A);
4001}
4002
4004inline bool operator!=(const simatrix& M1, const simatrix_slice& M2) {
4005 return !spsp_mm_comp(M1,M2.A);
4006}
4007
4009inline bool operator!=(const simatrix_slice& M1, const rmatrix& M2) {
4010 return !spf_mm_comp(M1.A,M2);
4011}
4012
4014inline bool operator!=(const srmatrix_slice& M1, const imatrix& M2) {
4015 return !spf_mm_comp(M1.A,M2);
4016}
4017
4019inline bool operator!=(const simatrix_slice& M1, const imatrix& M2) {
4020 return !spf_mm_comp(M1.A,M2);
4021}
4022
4024inline bool operator!=(const imatrix& M1, const srmatrix_slice& M2) {
4025 return !fsp_mm_comp(M1,M2.A);
4026}
4027
4029inline bool operator!=(const rmatrix& M1, const simatrix_slice& M2) {
4030 return !fsp_mm_comp(M1,M2.A);
4031}
4032
4034inline bool operator!=(const imatrix& M1, const simatrix_slice& M2) {
4035 return !fsp_mm_comp(M1,M2.A);
4036}
4037
4039inline bool operator!=(const imatrix_slice& M1, const srmatrix_slice& M2) {
4040 return !fsp_mm_comp(M1,M2.A);
4041}
4042
4044inline bool operator!=(const rmatrix_slice& M1, const simatrix_slice& M2) {
4045 return !fsp_mm_comp(M1,M2.A);
4046}
4047
4049inline bool operator!=(const imatrix_slice& M1, const simatrix_slice& M2) {
4050 return !fsp_mm_comp(M1,M2.A);
4051}
4052
4054inline bool operator!=(const simatrix_slice& M1, const rmatrix_slice& M2) {
4055 return !spf_mm_comp(M1.A,M2);
4056}
4057
4059inline bool operator!=(const srmatrix_slice& M1, const imatrix_slice& M2) {
4060 return !spf_mm_comp(M1.A,M2);
4061}
4062
4064inline bool operator!=(const simatrix_slice& M1, const imatrix_slice& M2) {
4065 return !spf_mm_comp(M1.A,M2);
4066}
4067
4069inline bool operator<(const srmatrix_slice& M1, const simatrix_slice& M2) {
4070 return spsp_mm_less<srmatrix,simatrix,interval>(M1.A,M2.A);
4071}
4072
4074inline bool operator<(const simatrix_slice& M1, const simatrix_slice& M2) {
4075 return spsp_mm_less<simatrix,simatrix,interval>(M1.A,M2.A);
4076}
4077
4079inline bool operator<(const srmatrix_slice& M1, const simatrix& M2) {
4080 return spsp_mm_less<srmatrix,simatrix,interval>(M1.A,M2);
4081}
4082
4084inline bool operator<(const simatrix_slice& M1, const simatrix& M2) {
4085 return spsp_mm_less<simatrix,simatrix,interval>(M1.A,M2);
4086}
4087
4089inline bool operator<(const srmatrix& M1, const simatrix_slice& M2) {
4090 return spsp_mm_less<srmatrix,simatrix,interval>(M1,M2.A);
4091}
4092
4094inline bool operator<(const simatrix& M1, const simatrix_slice& M2) {
4095 return spsp_mm_less<simatrix,simatrix,interval>(M1,M2.A);
4096}
4097
4099inline bool operator<(const srmatrix_slice& M1, const imatrix& M2) {
4100 return spf_mm_less<srmatrix,imatrix,interval>(M1.A,M2);
4101}
4102
4104inline bool operator<(const simatrix_slice& M1, const imatrix& M2) {
4105 return spf_mm_less<simatrix,imatrix,interval>(M1.A,M2);
4106}
4107
4109inline bool operator<(const rmatrix& M1, const simatrix_slice& M2) {
4110 return fsp_mm_less<rmatrix,simatrix,interval>(M1,M2.A);
4111}
4112
4114inline bool operator<(const imatrix& M1, const simatrix_slice& M2) {
4115 return fsp_mm_less<imatrix,simatrix,interval>(M1,M2.A);
4116}
4117
4119inline bool operator<(const rmatrix_slice& M1, const simatrix_slice& M2) {
4120 return fsp_mm_less<rmatrix_slice,simatrix,interval>(M1,M2.A);
4121}
4122
4124inline bool operator<(const imatrix_slice& M1, const simatrix_slice& M2) {
4125 return fsp_mm_less<imatrix_slice,simatrix,interval>(M1,M2.A);
4126}
4127
4129inline bool operator<(const srmatrix_slice& M1, const imatrix_slice& M2) {
4130 return spf_mm_less<srmatrix,imatrix_slice,interval>(M1.A,M2);
4131}
4132
4134inline bool operator<(const simatrix_slice& M1, const imatrix_slice& M2) {
4135 return spf_mm_less<simatrix,imatrix_slice,interval>(M1.A,M2);
4136}
4137
4139inline bool operator<=(const srmatrix_slice& M1, const simatrix_slice& M2) {
4140 return spsp_mm_leq<srmatrix,simatrix,interval>(M1.A,M2.A);
4141}
4142
4144inline bool operator<=(const simatrix_slice& M1, const simatrix_slice& M2) {
4145 return spsp_mm_leq<simatrix,simatrix,interval>(M1.A,M2.A);
4146}
4147
4149inline bool operator<=(const srmatrix_slice& M1, const simatrix& M2) {
4150 return spsp_mm_leq<srmatrix,simatrix,interval>(M1.A,M2);
4151}
4152
4154inline bool operator<=(const simatrix_slice& M1, const simatrix& M2) {
4155 return spsp_mm_leq<simatrix,simatrix,interval>(M1.A,M2);
4156}
4157
4159inline bool operator<=(const srmatrix& M1, const simatrix_slice& M2) {
4160 return spsp_mm_leq<srmatrix,simatrix,interval>(M1,M2.A);
4161}
4162
4164inline bool operator<=(const simatrix& M1, const simatrix_slice& M2) {
4165 return spsp_mm_leq<simatrix,simatrix,interval>(M1,M2.A);
4166}
4167
4169inline bool operator<=(const srmatrix_slice& M1, const imatrix& M2) {
4170 return spf_mm_leq<srmatrix,imatrix,interval>(M1.A,M2);
4171}
4172
4174inline bool operator<=(const simatrix_slice& M1, const imatrix& M2) {
4175 return spf_mm_leq<simatrix,imatrix,interval>(M1.A,M2);
4176}
4177
4179inline bool operator<=(const rmatrix& M1, const simatrix_slice& M2) {
4180 return fsp_mm_leq<rmatrix,simatrix,interval>(M1,M2.A);
4181}
4182
4184inline bool operator<=(const imatrix& M1, const simatrix_slice& M2) {
4185 return fsp_mm_leq<imatrix,simatrix,interval>(M1,M2.A);
4186}
4187
4189inline bool operator<=(const rmatrix_slice& M1, const simatrix_slice& M2) {
4190 return fsp_mm_leq<rmatrix_slice,simatrix,interval>(M1,M2.A);
4191}
4192
4194inline bool operator<=(const imatrix_slice& M1, const simatrix_slice& M2) {
4195 return fsp_mm_leq<imatrix_slice,simatrix,interval>(M1,M2.A);
4196}
4197
4199inline bool operator<=(const srmatrix_slice& M1, const imatrix_slice& M2) {
4200 return spf_mm_leq<srmatrix,imatrix_slice,interval>(M1.A,M2);
4201}
4202
4204inline bool operator<=(const simatrix_slice& M1, const imatrix_slice& M2) {
4205 return spf_mm_leq<simatrix,imatrix_slice,interval>(M1.A,M2);
4206}
4207
4209inline bool operator>(const simatrix_slice& M1, const srmatrix_slice& M2) {
4210 return spsp_mm_greater<simatrix,srmatrix,interval>(M1.A,M2.A);
4211}
4212
4214inline bool operator>(const simatrix_slice& M1, const simatrix_slice& M2) {
4215 return spsp_mm_greater<simatrix,simatrix,interval>(M1.A,M2.A);
4216}
4217
4219inline bool operator>(const simatrix_slice& M1, const srmatrix& M2) {
4220 return spsp_mm_greater<simatrix,srmatrix,interval>(M1.A,M2);
4221}
4222
4224inline bool operator>(const simatrix_slice& M1, const simatrix& M2) {
4225 return spsp_mm_greater<simatrix,simatrix,interval>(M1.A,M2);
4226}
4227
4229inline bool operator>(const simatrix& M1, const srmatrix_slice& M2) {
4230 return spsp_mm_greater<simatrix,srmatrix,interval>(M1,M2.A);
4231}
4232
4234inline bool operator>(const simatrix& M1, const simatrix_slice& M2) {
4235 return spsp_mm_greater<simatrix,simatrix,interval>(M1,M2.A);
4236}
4237
4239inline bool operator>(const simatrix_slice& M1, const rmatrix& M2) {
4240 return spf_mm_greater<simatrix,rmatrix,interval>(M1.A,M2);
4241}
4242
4244inline bool operator>(const simatrix_slice& M1, const imatrix& M2) {
4245 return spf_mm_greater<simatrix,imatrix,interval>(M1.A,M2);
4246}
4247
4249inline bool operator>(const imatrix& M1, const srmatrix_slice& M2) {
4250 return fsp_mm_greater<imatrix,srmatrix,interval>(M1,M2.A);
4251}
4252
4254inline bool operator>(const imatrix& M1, const simatrix_slice& M2) {
4255 return fsp_mm_greater<imatrix,simatrix,interval>(M1,M2.A);
4256}
4257
4259inline bool operator>(const imatrix_slice& M1, const srmatrix_slice& M2) {
4260 return fsp_mm_greater<imatrix,srmatrix,interval>(M1,M2.A);
4261}
4262
4264inline bool operator>(const imatrix_slice& M1, const simatrix_slice& M2) {
4265 return fsp_mm_greater<imatrix_slice,simatrix,interval>(M1,M2.A);
4266}
4267
4269inline bool operator>(const simatrix_slice& M1, const rmatrix_slice& M2) {
4270 return spf_mm_greater<simatrix,rmatrix_slice,interval>(M1.A,M2);
4271}
4272
4274inline bool operator>(const simatrix_slice& M1, const imatrix_slice& M2) {
4275 return spf_mm_greater<simatrix,imatrix_slice,interval>(M1.A,M2);
4276}
4277
4279inline bool operator>=(const simatrix_slice& M1, const srmatrix_slice& M2) {
4280 return spsp_mm_geq<simatrix,srmatrix,interval>(M1.A,M2.A);
4281}
4282
4284inline bool operator>=(const simatrix_slice& M1, const simatrix_slice& M2) {
4285 return spsp_mm_geq<simatrix,simatrix,interval>(M1.A,M2.A);
4286}
4287
4289inline bool operator>=(const simatrix_slice& M1, const srmatrix& M2) {
4290 return spsp_mm_geq<simatrix,srmatrix,interval>(M1.A,M2);
4291}
4292
4294inline bool operator>=(const simatrix_slice& M1, const simatrix& M2) {
4295 return spsp_mm_geq<simatrix,simatrix,interval>(M1.A,M2);
4296}
4297
4299inline bool operator>=(const simatrix& M1, const srmatrix_slice& M2) {
4300 return spsp_mm_geq<simatrix,srmatrix,interval>(M1,M2.A);
4301}
4302
4304inline bool operator>=(const simatrix& M1, const simatrix_slice& M2) {
4305 return spsp_mm_geq<simatrix,simatrix,interval>(M1,M2.A);
4306}
4307
4309inline bool operator>=(const simatrix_slice& M1, const rmatrix& M2) {
4310 return spf_mm_geq<simatrix,rmatrix,interval>(M1.A,M2);
4311}
4312
4314inline bool operator>=(const simatrix_slice& M1, const imatrix& M2) {
4315 return spf_mm_geq<simatrix,imatrix,interval>(M1.A,M2);
4316}
4317
4319inline bool operator>=(const imatrix& M1, const srmatrix_slice& M2) {
4320 return fsp_mm_geq<imatrix,srmatrix,interval>(M1,M2.A);
4321}
4322
4324inline bool operator>=(const imatrix& M1, const simatrix_slice& M2) {
4325 return fsp_mm_geq<imatrix,simatrix,interval>(M1,M2.A);
4326}
4327
4329inline bool operator>=(const imatrix_slice& M1, const srmatrix_slice& M2) {
4330 return fsp_mm_geq<imatrix,srmatrix,interval>(M1,M2.A);
4331}
4332
4334inline bool operator>=(const imatrix_slice& M1, const simatrix_slice& M2) {
4335 return fsp_mm_geq<imatrix_slice,simatrix,interval>(M1,M2.A);
4336}
4337
4339inline bool operator>=(const simatrix_slice& M1, const rmatrix_slice& M2) {
4340 return spf_mm_geq<simatrix,rmatrix_slice,interval>(M1.A,M2);
4341}
4342
4344inline bool operator>=(const simatrix_slice& M1, const imatrix_slice& M2) {
4345 return spf_mm_geq<simatrix,imatrix_slice,interval>(M1.A,M2);
4346}
4347
4349inline bool operator!(const simatrix_slice& M) {
4350 return sp_m_not(M.A);
4351}
4352
4354
4359inline std::ostream& operator<<(std::ostream& os, const simatrix_slice& M) {
4360 return sp_m_output<simatrix,interval>(os, M.A);
4361}
4362
4364
4369inline std::istream& operator>>(std::istream& is, simatrix_slice& M) {
4370 simatrix tmp(M.A.m, M.A.n);
4371 sp_m_input<simatrix,interval>(is, tmp);
4372 M = tmp;
4373 return is;
4374}
4375
4376
4378
4384 private:
4385 simatrix_slice dat;
4386 bool row;
4387 int index;
4388
4389 simatrix_subv(simatrix& A, bool r, int i, int j, int k, int l) : dat(A,i,j,k,l), row(r) {
4390 if(row) index=i; else index=k;
4391 }
4392
4393 simatrix_subv(const simatrix& A, bool r, int i, int j, int k, int l) : dat(A,i,j,k,l), row(r) {
4394 if(row) index=i; else index=k;
4395 }
4396
4397 public:
4399
4403 interval& operator[](const int i) {
4404 if(row) {
4405#if(CXSC_INDEX_CHECK)
4406 if(i<dat.A.lb2 || i>dat.A.ub2)
4407 cxscthrow(ELEMENT_NOT_IN_VEC("simatrix_subv::operator[](int)"));
4408#endif
4409 return dat.element(index,i);
4410 } else {
4411#if(CXSC_INDEX_CHECK)
4412 if(i<dat.A.lb1 || i>dat.A.ub1)
4413 cxscthrow(ELEMENT_NOT_IN_VEC("simatrix_subv::operator[](int)"));
4414#endif
4415 return dat.element(i,index);
4416 }
4417 }
4418
4420
4423 const interval operator[](const int i) const{
4424 if(row) {
4425#if(CXSC_INDEX_CHECK)
4426 if(i<dat.A.lb2 || i>dat.A.ub2)
4427 cxscthrow(ELEMENT_NOT_IN_VEC("simatrix_subv::operator[](int)"));
4428#endif
4429 return dat(index,i);
4430 } else {
4431#if(CXSC_INDEX_CHECK)
4432 if(i<dat.A.lb1 || i>dat.A.ub1)
4433 cxscthrow(ELEMENT_NOT_IN_VEC("simatrix_subv::operator[](int)"));
4434#endif
4435 return dat(i,index);
4436 }
4437 }
4438
4441 return sv_vs_assign(*this,v);
4442 }
4443
4446 return sv_vs_assign(*this,v);
4447 }
4448
4451 return svsp_vv_assign(*this,v);
4452 }
4453
4456 return svsp_vv_assign(*this,v);
4457 }
4458
4461 return svsl_vv_assign(*this,v);
4462 }
4463
4466 return svsl_vv_assign(*this,v);
4467 }
4468
4471 return svf_vv_assign(*this,v);
4472 }
4473
4476 return svf_vv_assign(*this,v);
4477 }
4478
4481 return svf_vv_assign(*this,v);
4482 }
4483
4486 return svf_vv_assign(*this,v);
4487 }
4488
4491 return svsp_vv_assign(*this,srvector(v));
4492 }
4493
4496 return svsp_vv_assign(*this,sivector(v));
4497 }
4498
4500 simatrix_subv& operator*=(const real&);
4504 simatrix_subv& operator/=(const real&);
4555
4556 friend sivector operator-(const simatrix_subv&);
4557
4558 friend std::istream& operator>>(std::istream&, simatrix_subv&);
4559
4560 friend int Lb(const simatrix_subv&);
4561 friend int Ub(const simatrix_subv&);
4562 friend int VecLen(const simatrix_subv&);
4563 friend srvector Inf(const simatrix_subv&);
4564 friend srvector Sup(const simatrix_subv&);
4565
4566 friend class srvector;
4567 friend class srmatrix;
4568 friend class srmatrix_slice;
4569 friend class sivector;
4570 friend class simatrix;
4571 friend class simatrix_slice;
4572 friend class scivector;
4573 friend class scimatrix;
4574 friend class scimatrix_slice;
4575
4576#include "vector_friend_declarations.inl"
4577};
4578
4580inline int Lb(const simatrix_subv& S) {
4581 if(S.row)
4582 return Lb(S.dat, 2);
4583 else
4584 return Lb(S.dat, 1);
4585}
4586
4588inline int Ub(const simatrix_subv& S) {
4589 if(S.row)
4590 return Ub(S.dat, 2);
4591 else
4592 return Ub(S.dat, 1);
4593}
4594
4596inline int VecLen(const simatrix_subv& S) {
4597 return Ub(S)-Lb(S)+1;
4598}
4599
4601inline srvector Inf(const simatrix_subv& S) {
4602 return Inf(sivector(S));
4603}
4604
4606inline srvector Sup(const simatrix_subv& S) {
4607 return Sup(sivector(S));
4608}
4609
4611inline srvector mid(const simatrix_subv& S) {
4612 return mid(sivector(S));
4613}
4614
4616inline srvector diam(const simatrix_subv& S) {
4617 return diam(sivector(S));
4618}
4619
4621inline sivector abs(const simatrix_subv& S) {
4622 return abs(sivector(S));
4623}
4624
4626inline std::ostream& operator<<(std::ostream& os, const simatrix_subv& v) {
4627 os << sivector(v);
4628 return os;
4629}
4630
4632inline std::istream& operator>>(std::istream& is, simatrix_subv& v) {
4633 int n = 0;
4634 if(v.row) n=v.dat.A.n; else n=v.dat.A.m;
4635 sivector tmp(n);
4636 is >> tmp;
4637 v = tmp;
4638 return is;
4639}
4640
4641inline simatrix_subv simatrix::operator[](const cxscmatrix_column& c) {
4642#if(CXSC_INDEX_CHECK)
4643 if(c.col()<lb2 || c.col()>ub2)
4644 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator[](const cxscmatrix_column&)"));
4645#endif
4646 return simatrix_subv(*this, false, lb1, ub1, c.col(), c.col());
4647}
4648
4650#if(CXSC_INDEX_CHECK)
4651 if(i<lb1 || i>ub1)
4652 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator[](const int)"));
4653#endif
4654 return simatrix_subv(*this, true, i, i, lb2, ub2);
4655}
4656
4657inline const simatrix_subv simatrix::operator[](const cxscmatrix_column& c) const {
4658#if(CXSC_INDEX_CHECK)
4659 if(c.col()<lb2 || c.col()>ub2)
4660 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator[](const cxscmatrix_column&)"));
4661#endif
4662 return simatrix_subv(*this, false, lb1, ub1, c.col(), c.col());
4663}
4664
4665inline const simatrix_subv simatrix::operator[](const int i) const {
4666#if(CXSC_INDEX_CHECK)
4667 if(i<lb1 || i>ub1)
4668 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator[](const int)"));
4669#endif
4670 return simatrix_subv(*this, true, i, i, lb2, ub2);
4671}
4672
4674#if(CXSC_INDEX_CHECK)
4675 if(i<A.lb1 || i>A.ub1)
4676 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator[](const int"));
4677#endif
4678 return simatrix_subv(*M, true, i, i, A.lb2, A.ub2);
4679}
4680
4681inline simatrix_subv simatrix_slice::operator[](const cxscmatrix_column& c) {
4682#if(CXSC_INDEX_CHECK)
4683 if(c.col()<A.lb2 || c.col()>A.ub2)
4684 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator[](const cxscmatrix_column&)"));
4685#endif
4686 return simatrix_subv(*M, false, A.lb1, A.ub1, c.col(), c.col());
4687}
4688
4689inline const simatrix_subv simatrix_slice::operator[](const int i) const {
4690#if(CXSC_INDEX_CHECK)
4691 if(i<A.lb1 || i>A.ub1)
4692 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator[](const int"));
4693#endif
4694 return simatrix_subv(*M, true, i, i, A.lb2, A.ub2);
4695}
4696
4697inline const simatrix_subv simatrix_slice::operator[](const cxscmatrix_column& c) const {
4698#if(CXSC_INDEX_CHECK)
4699 if(c.col()<A.lb2 || c.col()>A.ub2)
4700 cxscthrow(ROW_OR_COL_NOT_IN_MAT("simatrix::operator[](const cxscmatrix_column&)"));
4701#endif
4702 return simatrix_subv(*M, false, A.lb1, A.ub1, c.col(), c.col());
4703}
4704
4706 int nnz = A.dat.A.get_nnz();
4707 p.reserve(nnz);
4708 x.reserve(nnz);
4709
4710 if(A.row) {
4711 lb = A.dat.A.lb2;
4712 ub = A.dat.A.ub2;
4713 n = ub-lb+1;
4714
4715 for(int j=0 ; j<n ; j++) {
4716 for(int k=A.dat.A.p[j] ; k<A.dat.A.p[j+1] ; k++) {
4717 p.push_back(j);
4718 x.push_back(A.dat.A.x[k]);
4719 }
4720 }
4721
4722 } else {
4723 lb = A.dat.A.lb1;
4724 ub = A.dat.A.ub1;
4725 n = ub-lb+1;
4726
4727 for(unsigned int k=0 ; k<A.dat.A.ind.size() ; k++) {
4728 p.push_back(A.dat.A.ind[k]);
4729 x.push_back(A.dat.A.x[k]);
4730 }
4731 }
4732}
4733
4735inline sivector operator-(const simatrix_subv& v) {
4736 sivector s(v);
4737 return -s;
4738}
4739
4741inline sivector operator/(const simatrix_subv& v1, const real& v2) {
4742 return sivector(v1) / v2;
4743}
4744
4746inline sivector operator/(const simatrix_subv& v1, const interval& v2) {
4747 return sivector(v1) / v2;
4748}
4749
4751inline sivector operator/(const srmatrix_subv& v1, const interval& v2) {
4752 return srvector(v1) / v2;
4753}
4754
4756inline sivector operator*(const simatrix_subv& v1, const real& v2) {
4757 return sivector(v1) * v2;
4758}
4759
4761inline sivector operator*(const simatrix_subv& v1, const interval& v2) {
4762 return sivector(v1) * v2;
4763}
4764
4766inline sivector operator*(const srmatrix_subv& v1, const interval& v2) {
4767 return srvector(v1) * v2;
4768}
4769
4771inline sivector operator*(const real& v1, const simatrix_subv& v2) {
4772 return v1 * sivector(v2);
4773}
4774
4776inline sivector operator*(const interval& v1, const simatrix_subv& v2) {
4777 return v1 * sivector(v2);
4778}
4779
4781inline sivector operator*(const interval& v1, const srmatrix_subv& v2) {
4782 return v1 * srvector(v2);
4783}
4784
4786
4792inline interval operator*(const simatrix_subv& v1, const srvector& v2) {
4793 return sivector(v1) * v2;
4794}
4795
4797
4803inline interval operator*(const srmatrix_subv& v1, const sivector& v2) {
4804 return srvector(v1) * v2;
4805}
4806
4808
4814inline interval operator*(const simatrix_subv& v1, const sivector& v2) {
4815 return sivector(v1) * v2;
4816}
4817
4819
4825inline interval operator*(const simatrix_subv& v1, const srvector_slice& v2) {
4826 return sivector(v1) * v2;
4827}
4828
4830
4836inline interval operator*(const srmatrix_subv& v1, const sivector_slice& v2) {
4837 return srvector(v1) * v2;
4838}
4839
4841
4847inline interval operator*(const simatrix_subv& v1, const sivector_slice& v2) {
4848 return sivector(v1) * v2;
4849}
4850
4852
4858inline interval operator*(const simatrix_subv& v1, const rvector& v2) {
4859 return sivector(v1) * v2;
4860}
4861
4863
4869inline interval operator*(const srmatrix_subv& v1, const ivector& v2) {
4870 return srvector(v1) * v2;
4871}
4872
4874
4880inline interval operator*(const simatrix_subv& v1, const ivector& v2) {
4881 return sivector(v1) * v2;
4882}
4883
4885
4891inline interval operator*(const simatrix_subv& v1, const rvector_slice& v2) {
4892 return sivector(v1) * v2;
4893}
4894
4896
4902inline interval operator*(const srmatrix_subv& v1, const ivector_slice& v2) {
4903 return srvector(v1) * v2;
4904}
4905
4907
4913inline interval operator*(const simatrix_subv& v1, const ivector_slice& v2) {
4914 return sivector(v1) * v2;
4915}
4916
4918
4924inline interval operator*(const sivector& v1, const srmatrix_subv& v2) {
4925 return v1 * srvector(v2);
4926}
4927
4929
4935inline interval operator*(const srvector& v1, const simatrix_subv& v2) {
4936 return v1 * sivector(v2);
4937}
4938
4940
4946inline interval operator*(const sivector& v1, const simatrix_subv& v2) {
4947 return v1 * sivector(v2);
4948}
4949
4951
4957inline interval operator*(const sivector_slice& v1, const srmatrix_subv& v2) {
4958 return v1 * srvector(v2);
4959}
4960
4962
4968inline interval operator*(const srvector_slice& v1, const simatrix_subv& v2) {
4969 return v1 * sivector(v2);
4970}
4971
4973
4979inline interval operator*(const sivector_slice& v1, const simatrix_subv& v2) {
4980 return v1 * sivector(v2);
4981}
4982
4984
4990inline interval operator*(const ivector& v1, const srmatrix_subv& v2) {
4991 return v1 * srvector(v2);
4992}
4993
4995
5001inline interval operator*(const rvector& v1, const simatrix_subv& v2) {
5002 return v1 * sivector(v2);
5003}
5004
5006
5012inline interval operator*(const ivector& v1, const simatrix_subv& v2) {
5013 return v1 * sivector(v2);
5014}
5015
5017
5023inline interval operator*(const ivector_slice& v1, const srmatrix_subv& v2) {
5024 return v1 * srvector(v2);
5025}
5026
5028
5034inline interval operator*(const rvector_slice& v1, const simatrix_subv& v2) {
5035 return v1 * sivector(v2);
5036}
5037
5039
5045inline interval operator*(const ivector_slice& v1, const simatrix_subv& v2) {
5046 return v1 * sivector(v2);
5047}
5048
5050inline sivector operator+(const simatrix_subv& v1, const srvector& v2) {
5051 return sivector(v1) + v2;
5052}
5053
5055inline sivector operator+(const srmatrix_subv& v1, const sivector& v2) {
5056 return srvector(v1) + v2;
5057}
5058
5060inline sivector operator+(const simatrix_subv& v1, const sivector& v2) {
5061 return sivector(v1) + v2;
5062}
5063
5065inline sivector operator+(const simatrix_subv& v1, const srvector_slice& v2) {
5066 return sivector(v1) + v2;
5067}
5068
5070inline sivector operator+(const srmatrix_subv& v1, const sivector_slice& v2) {
5071 return srvector(v1) + v2;
5072}
5073
5075inline sivector operator+(const simatrix_subv& v1, const sivector_slice& v2) {
5076 return sivector(v1) + v2;
5077}
5078
5080inline ivector operator+(const simatrix_subv& v1, const rvector& v2) {
5081 return sivector(v1) + v2;
5082}
5083
5085inline ivector operator+(const srmatrix_subv& v1, const ivector& v2) {
5086 return srvector(v1) + v2;
5087}
5088
5090inline ivector operator+(const simatrix_subv& v1, const ivector& v2) {
5091 return sivector(v1) + v2;
5092}
5093
5095inline ivector operator+(const simatrix_subv& v1, const rvector_slice& v2) {
5096 return sivector(v1) + v2;
5097}
5098
5100inline ivector operator+(const srmatrix_subv& v1, const ivector_slice& v2) {
5101 return srvector(v1) + v2;
5102}
5103
5105inline ivector operator+(const simatrix_subv& v1, const ivector_slice& v2) {
5106 return sivector(v1) + v2;
5107}
5108
5110inline sivector operator+(const sivector& v1, const srmatrix_subv& v2) {
5111 return v1 + srvector(v2);
5112}
5113
5115inline sivector operator+(const srvector& v1, const simatrix_subv& v2) {
5116 return v1 + sivector(v2);
5117}
5118
5120inline sivector operator+(const sivector& v1, const simatrix_subv& v2) {
5121 return v1 + sivector(v2);
5122}
5123
5125inline sivector operator+(const sivector_slice& v1, const srmatrix_subv& v2) {
5126 return v1 + srvector(v2);
5127}
5128
5130inline sivector operator+(const srvector_slice& v1, const simatrix_subv& v2) {
5131 return v1 + sivector(v2);
5132}
5133
5135inline sivector operator+(const sivector_slice& v1, const simatrix_subv& v2) {
5136 return v1 + sivector(v2);
5137}
5138
5140inline ivector operator+(const ivector& v1, const srmatrix_subv& v2) {
5141 return v1 + srvector(v2);
5142}
5143
5145inline ivector operator+(const rvector& v1, const simatrix_subv& v2) {
5146 return v1 + sivector(v2);
5147}
5148
5150inline ivector operator+(const ivector& v1, const simatrix_subv& v2) {
5151 return v1 + sivector(v2);
5152}
5153
5155inline ivector operator+(const ivector_slice& v1, const srmatrix_subv& v2) {
5156 return v1 + srvector(v2);
5157}
5158
5160inline ivector operator+(const rvector_slice& v1, const simatrix_subv& v2) {
5161 return v1 + sivector(v2);
5162}
5163
5165inline ivector operator+(const ivector_slice& v1, const simatrix_subv& v2) {
5166 return v1 + sivector(v2);
5167}
5168
5170inline sivector operator-(const simatrix_subv& v1, const srvector& v2) {
5171 return sivector(v1) - v2;
5172}
5173
5175inline sivector operator-(const srmatrix_subv& v1, const sivector& v2) {
5176 return srvector(v1) - v2;
5177}
5178
5180inline sivector operator-(const simatrix_subv& v1, const sivector& v2) {
5181 return sivector(v1) - v2;
5182}
5183
5185inline sivector operator-(const simatrix_subv& v1, const srvector_slice& v2) {
5186 return sivector(v1) - v2;
5187}
5188
5190inline sivector operator-(const srmatrix_subv& v1, const sivector_slice& v2) {
5191 return srvector(v1) - v2;
5192}
5193
5195inline sivector operator-(const simatrix_subv& v1, const sivector_slice& v2) {
5196 return sivector(v1) - v2;
5197}
5198
5200inline ivector operator-(const simatrix_subv& v1, const rvector& v2) {
5201 return sivector(v1) - v2;
5202}
5203
5205inline ivector operator-(const srmatrix_subv& v1, const ivector& v2) {
5206 return srvector(v1) - v2;
5207}
5208
5210inline ivector operator-(const simatrix_subv& v1, const ivector& v2) {
5211 return sivector(v1) - v2;
5212}
5213
5215inline ivector operator-(const simatrix_subv& v1, const rvector_slice& v2) {
5216 return sivector(v1) - v2;
5217}
5218
5220inline ivector operator-(const srmatrix_subv& v1, const ivector_slice& v2) {
5221 return srvector(v1) - v2;
5222}
5223
5225inline ivector operator-(const simatrix_subv& v1, const ivector_slice& v2) {
5226 return sivector(v1) - v2;
5227}
5228
5230inline sivector operator-(const sivector& v1, const srmatrix_subv& v2) {
5231 return v1 - srvector(v2);
5232}
5233
5235inline sivector operator-(const srvector& v1, const simatrix_subv& v2) {
5236 return v1 - sivector(v2);
5237}
5238
5240inline sivector operator-(const sivector& v1, const simatrix_subv& v2) {
5241 return v1 - sivector(v2);
5242}
5243
5245inline sivector operator-(const sivector_slice& v1, const srmatrix_subv& v2) {
5246 return v1 - srvector(v2);
5247}
5248
5250inline sivector operator-(const srvector_slice& v1, const simatrix_subv& v2) {
5251 return v1 - sivector(v2);
5252}
5253
5255inline sivector operator-(const sivector_slice& v1, const simatrix_subv& v2) {
5256 return v1 - sivector(v2);
5257}
5258
5260inline ivector operator-(const ivector& v1, const srmatrix_subv& v2) {
5261 return v1 - srvector(v2);
5262}
5263
5265inline ivector operator-(const rvector& v1, const simatrix_subv& v2) {
5266 return v1 - sivector(v2);
5267}
5268
5270inline ivector operator-(const ivector& v1, const simatrix_subv& v2) {
5271 return v1 - sivector(v2);
5272}
5273
5275inline ivector operator-(const ivector_slice& v1, const srmatrix_subv& v2) {
5276 return v1 - srvector(v2);
5277}
5278
5280inline ivector operator-(const rvector_slice& v1, const simatrix_subv& v2) {
5281 return v1 - sivector(v2);
5282}
5283
5285inline ivector operator-(const ivector_slice& v1, const simatrix_subv& v2) {
5286 return v1 - sivector(v2);
5287}
5288
5290inline sivector operator|(const simatrix_subv& v1, const srvector& v2) {
5291 return sivector(v1) | v2;
5292}
5293
5295inline sivector operator|(const srmatrix_subv& v1, const sivector& v2) {
5296 return srvector(v1) | v2;
5297}
5298
5300inline sivector operator|(const simatrix_subv& v1, const sivector& v2) {
5301 return sivector(v1) | v2;
5302}
5303
5305inline sivector operator|(const simatrix_subv& v1, const srvector_slice& v2) {
5306 return sivector(v1) | v2;
5307}
5308
5310inline sivector operator|(const srmatrix_subv& v1, const sivector_slice& v2) {
5311 return srvector(v1) | v2;
5312}
5313
5315inline sivector operator|(const simatrix_subv& v1, const sivector_slice& v2) {
5316 return sivector(v1) | v2;
5317}
5318
5320inline ivector operator|(const simatrix_subv& v1, const rvector& v2) {
5321 return sivector(v1) | v2;
5322}
5323
5325inline ivector operator|(const srmatrix_subv& v1, const ivector& v2) {
5326 return srvector(v1) | v2;
5327}
5328
5330inline ivector operator|(const simatrix_subv& v1, const ivector& v2) {
5331 return sivector(v1) | v2;
5332}
5333
5335inline ivector operator|(const simatrix_subv& v1, const rvector_slice& v2) {
5336 return sivector(v1) | v2;
5337}
5338
5340inline ivector operator|(const srmatrix_subv& v1, const ivector_slice& v2) {
5341 return srvector(v1) | v2;
5342}
5343
5345inline ivector operator|(const simatrix_subv& v1, const ivector_slice& v2) {
5346 return sivector(v1) | v2;
5347}
5348
5350inline sivector operator|(const sivector& v1, const srmatrix_subv& v2) {
5351 return v1 | srvector(v2);
5352}
5353
5355inline sivector operator|(const srvector& v1, const simatrix_subv& v2) {
5356 return v1 | sivector(v2);
5357}
5358
5360inline sivector operator|(const sivector& v1, const simatrix_subv& v2) {
5361 return v1 | sivector(v2);
5362}
5363
5365inline sivector operator|(const sivector_slice& v1, const srmatrix_subv& v2) {
5366 return v1 | srvector(v2);
5367}
5368
5370inline sivector operator|(const srvector_slice& v1, const simatrix_subv& v2) {
5371 return v1 | sivector(v2);
5372}
5373
5375inline sivector operator|(const sivector_slice& v1, const simatrix_subv& v2) {
5376 return v1 | sivector(v2);
5377}
5378
5380inline ivector operator|(const ivector& v1, const srmatrix_subv& v2) {
5381 return v1 | srvector(v2);
5382}
5383
5385inline ivector operator|(const rvector& v1, const simatrix_subv& v2) {
5386 return v1 | sivector(v2);
5387}
5388
5390inline ivector operator|(const ivector& v1, const simatrix_subv& v2) {
5391 return v1 | sivector(v2);
5392}
5393
5395inline ivector operator|(const ivector_slice& v1, const srmatrix_subv& v2) {
5396 return v1 | srvector(v2);
5397}
5398
5400inline ivector operator|(const rvector_slice& v1, const simatrix_subv& v2) {
5401 return v1 | sivector(v2);
5402}
5403
5405inline ivector operator|(const ivector_slice& v1, const simatrix_subv& v2) {
5406 return v1 | sivector(v2);
5407}
5408
5410inline sivector operator|(const srmatrix_subv& v1, const srvector& v2) {
5411 return srvector(v1) | v2;
5412}
5413
5415inline sivector operator|(const srmatrix_subv& v1, const srvector_slice& v2) {
5416 return srvector(v1) | v2;
5417}
5418
5420inline ivector operator|(const srmatrix_subv& v1, const rvector& v2) {
5421 return srvector(v1) | v2;
5422}
5423
5425inline ivector operator|(const srmatrix_subv& v1, const rvector_slice& v2) {
5426 return srvector(v1) | v2;
5427}
5428
5430inline sivector operator|(const srvector& v1, const srmatrix_subv& v2) {
5431 return v1 | srvector(v2);
5432}
5433
5435inline sivector operator|(const srvector_slice& v1, const srmatrix_subv& v2) {
5436 return v1 | srvector(v2);
5437}
5438
5440inline ivector operator|(const rvector& v1, const srmatrix_subv& v2) {
5441 return v1 | srvector(v2);
5442}
5443
5445inline ivector operator|(const rvector_slice& v1, const srmatrix_subv& v2) {
5446 return v1 | srvector(v2);
5447}
5448
5450 *this = *this * v;
5451 return *this;
5452}
5453
5455 *this = *this * v;
5456 return *this;
5457}
5458
5460 *this = *this / v;
5461 return *this;
5462}
5463
5465 *this = *this / v;
5466 return *this;
5467}
5468
5470 *this = *this + v;
5471 return *this;
5472}
5473
5475 *this = *this + v;
5476 return *this;
5477}
5478
5480 *this = *this + v;
5481 return *this;
5482}
5483
5485 *this = *this + v;
5486 return *this;
5487}
5488
5490 *this = *this - v;
5491 return *this;
5492}
5493
5495 *this = *this - v;
5496 return *this;
5497}
5498
5500 *this = *this - v;
5501 return *this;
5502}
5503
5505 *this = *this - v;
5506 return *this;
5507}
5508
5510 *this = *this + v;
5511 return *this;
5512}
5513
5515 *this = *this + v;
5516 return *this;
5517}
5518
5520 *this = *this + v;
5521 return *this;
5522}
5523
5525 *this = *this + v;
5526 return *this;
5527}
5528
5530 *this = *this - v;
5531 return *this;
5532}
5533
5535 *this = *this - v;
5536 return *this;
5537}
5538
5540 *this = *this - v;
5541 return *this;
5542}
5543
5545 *this = *this - v;
5546 return *this;
5547}
5548
5550 *this = *this | v;
5551 return *this;
5552}
5553
5555 *this = *this | v;
5556 return *this;
5557}
5558
5560 *this = *this | v;
5561 return *this;
5562}
5563
5565 *this = *this | v;
5566 return *this;
5567}
5568
5570 *this = *this | v;
5571 return *this;
5572}
5573
5575 *this = *this | v;
5576 return *this;
5577}
5578
5580 *this = *this | v;
5581 return *this;
5582}
5583
5585 *this = *this | v;
5586 return *this;
5587}
5588
5590 *this += rvector(v);
5591 return *this;
5592}
5593
5595 *this += ivector(v);
5596 return *this;
5597}
5598
5600 *this += rvector(v);
5601 return *this;
5602}
5603
5605 *this += ivector(v);
5606 return *this;
5607}
5608
5610 *this += rvector(v);
5611 return *this;
5612}
5613
5615 *this += ivector(v);
5616 return *this;
5617}
5618
5620 *this -= rvector(v);
5621 return *this;
5622}
5623
5625 *this -= ivector(v);
5626 return *this;
5627}
5628
5630 *this -= rvector(v);
5631 return *this;
5632}
5633
5635 *this -= ivector(v);
5636 return *this;
5637}
5638
5640 *this -= rvector(v);
5641 return *this;
5642}
5643
5645 *this -= ivector(v);
5646 return *this;
5647}
5648
5650 *this |= rvector(v);
5651 return *this;
5652}
5653
5655 *this |= ivector(v);
5656 return *this;
5657}
5658
5660 *this |= rvector(v);
5661 return *this;
5662}
5663
5665 *this |= ivector(v);
5666 return *this;
5667}
5668
5670 *this |= rvector(v);
5671 return *this;
5672}
5673
5675 *this |= ivector(v);
5676 return *this;
5677}
5678
5680 *this &= rvector(v);
5681 return *this;
5682}
5683
5685 *this &= ivector(v);
5686 return *this;
5687}
5688
5690 *this &= rvector(v);
5691 return *this;
5692}
5693
5695 *this &= ivector(v);
5696 return *this;
5697}
5698
5700 *this &= rvector(v);
5701 return *this;
5702}
5703
5705 *this &= ivector(v);
5706 return *this;
5707}
5708
5710 *this = rvector(v);
5711 return *this;
5712}
5713
5715 *this = ivector(v);
5716 return *this;
5717}
5718
5720 *this = rvector(v);
5721 return *this;
5722}
5723
5725 *this = ivector(v);
5726 return *this;
5727}
5728
5730 *this = rvector(v);
5731 return *this;
5732}
5733
5735 *this = ivector(v);
5736 return *this;
5737}
5738
5740inline bool operator==(const simatrix_subv& v1, const srvector& v2) {
5741 return sivector(v1) == v2;
5742}
5743
5745inline bool operator==(const srmatrix_subv& v1, const sivector& v2) {
5746 return srvector(v1) == v2;
5747}
5748
5750inline bool operator==(const simatrix_subv& v1, const sivector& v2) {
5751 return sivector(v1) == v2;
5752}
5753
5755inline bool operator==(const simatrix_subv& v1, const srvector_slice& v2) {
5756 return sivector(v1) == v2;
5757}
5758
5760inline bool operator==(const srmatrix_subv& v1, const sivector_slice& v2) {
5761 return srvector(v1) == v2;
5762}
5763
5765inline bool operator==(const simatrix_subv& v1, const sivector_slice& v2) {
5766 return sivector(v1) == v2;
5767}
5768
5770inline bool operator==(const simatrix_subv& v1, const rvector& v2) {
5771 return sivector(v1) == v2;
5772}
5773
5775inline bool operator==(const srmatrix_subv& v1, const ivector& v2) {
5776 return srvector(v1) == v2;
5777}
5778
5780inline bool operator==(const simatrix_subv& v1, const ivector& v2) {
5781 return sivector(v1) == v2;
5782}
5783
5785inline bool operator==(const simatrix_subv& v1, const rvector_slice& v2) {
5786 return sivector(v1) == v2;
5787}
5788
5790inline bool operator==(const srmatrix_subv& v1, const ivector_slice& v2) {
5791 return srvector(v1) == v2;
5792}
5793
5795inline bool operator==(const simatrix_subv& v1, const ivector_slice& v2) {
5796 return sivector(v1) == v2;
5797}
5798
5800inline bool operator==(const sivector& v1, const srmatrix_subv& v2) {
5801 return v1 == srvector(v2);
5802}
5803
5805inline bool operator==(const srvector& v1, const simatrix_subv& v2) {
5806 return v1 == sivector(v2);
5807}
5808
5810inline bool operator==(const sivector& v1, const simatrix_subv& v2) {
5811 return v1 == sivector(v2);
5812}
5813
5815inline bool operator==(const sivector_slice& v1, const srmatrix_subv& v2) {
5816 return v1 == srvector(v2);
5817}
5818
5820inline bool operator==(const srvector_slice& v1, const simatrix_subv& v2) {
5821 return v1 == sivector(v2);
5822}
5823
5825inline bool operator==(const sivector_slice& v1, const simatrix_subv& v2) {
5826 return v1 == sivector(v2);
5827}
5828
5830inline bool operator==(const ivector& v1, const srmatrix_subv& v2) {
5831 return v1 == srvector(v2);
5832}
5833
5835inline bool operator==(const rvector& v1, const simatrix_subv& v2) {
5836 return v1 == sivector(v2);
5837}
5838
5840inline bool operator==(const ivector& v1, const simatrix_subv& v2) {
5841 return v1 == sivector(v2);
5842}
5843
5845inline bool operator==(const ivector_slice& v1, const srmatrix_subv& v2) {
5846 return v1 == srvector(v2);
5847}
5848
5850inline bool operator==(const rvector_slice& v1, const simatrix_subv& v2) {
5851 return v1 == sivector(v2);
5852}
5853
5855inline bool operator==(const ivector_slice& v1, const simatrix_subv& v2) {
5856 return v1 == sivector(v2);
5857}
5858
5860inline bool operator!=(const simatrix_subv& v1, const srvector& v2) {
5861 return sivector(v1) != v2;
5862}
5863
5865inline bool operator!=(const srmatrix_subv& v1, const sivector& v2) {
5866 return srvector(v1) != v2;
5867}
5868
5870inline bool operator!=(const simatrix_subv& v1, const sivector& v2) {
5871 return sivector(v1) != v2;
5872}
5873
5875inline bool operator!=(const simatrix_subv& v1, const srvector_slice& v2) {
5876 return sivector(v1) != v2;
5877}
5878
5880inline bool operator!=(const srmatrix_subv& v1, const sivector_slice& v2) {
5881 return srvector(v1) != v2;
5882}
5883
5885inline bool operator!=(const simatrix_subv& v1, const sivector_slice& v2) {
5886 return sivector(v1) != v2;
5887}
5888
5890inline bool operator!=(const simatrix_subv& v1, const rvector& v2) {
5891 return sivector(v1) != v2;
5892}
5893
5895inline bool operator!=(const srmatrix_subv& v1, const ivector& v2) {
5896 return srvector(v1) != v2;
5897}
5898
5900inline bool operator!=(const simatrix_subv& v1, const ivector& v2) {
5901 return sivector(v1) != v2;
5902}
5903
5905inline bool operator!=(const simatrix_subv& v1, const rvector_slice& v2) {
5906 return sivector(v1) != v2;
5907}
5908
5910inline bool operator!=(const srmatrix_subv& v1, const ivector_slice& v2) {
5911 return srvector(v1) != v2;
5912}
5913
5915inline bool operator!=(const simatrix_subv& v1, const ivector_slice& v2) {
5916 return sivector(v1) != v2;
5917}
5918
5920inline bool operator!=(const sivector& v1, const srmatrix_subv& v2) {
5921 return v1 != srvector(v2);
5922}
5923
5925inline bool operator!=(const srvector& v1, const simatrix_subv& v2) {
5926 return v1 != sivector(v2);
5927}
5928
5930inline bool operator!=(const sivector& v1, const simatrix_subv& v2) {
5931 return v1 != sivector(v2);
5932}
5933
5935inline bool operator!=(const sivector_slice& v1, const srmatrix_subv& v2) {
5936 return v1 != srvector(v2);
5937}
5938
5940inline bool operator!=(const srvector_slice& v1, const simatrix_subv& v2) {
5941 return v1 != sivector(v2);
5942}
5943
5945inline bool operator!=(const sivector_slice& v1, const simatrix_subv& v2) {
5946 return v1 != sivector(v2);
5947}
5948
5950inline bool operator!=(const ivector& v1, const srmatrix_subv& v2) {
5951 return v1 != srvector(v2);
5952}
5953
5955inline bool operator!=(const rvector& v1, const simatrix_subv& v2) {
5956 return v1 != sivector(v2);
5957}
5958
5960inline bool operator!=(const ivector& v1, const simatrix_subv& v2) {
5961 return v1 != sivector(v2);
5962}
5963
5965inline bool operator!=(const ivector_slice& v1, const srmatrix_subv& v2) {
5966 return v1 != srvector(v2);
5967}
5968
5970inline bool operator!=(const rvector_slice& v1, const simatrix_subv& v2) {
5971 return v1 != sivector(v2);
5972}
5973
5975inline bool operator!=(const ivector_slice& v1, const simatrix_subv& v2) {
5976 return v1 != sivector(v2);
5977}
5978
5980inline bool operator<(const srmatrix_subv& v1, const sivector& v2) {
5981 return srvector(v1) < v2;
5982}
5983
5985inline bool operator<(const simatrix_subv& v1, const sivector& v2) {
5986 return sivector(v1) < v2;
5987}
5988
5990inline bool operator<(const srmatrix_subv& v1, const sivector_slice& v2) {
5991 return srvector(v1) < v2;
5992}
5993
5995inline bool operator<(const simatrix_subv& v1, const sivector_slice& v2) {
5996 return sivector(v1) < v2;
5997}
5998
6000inline bool operator<(const srmatrix_subv& v1, const ivector& v2) {
6001 return srvector(v1) < v2;
6002}
6003
6005inline bool operator<(const simatrix_subv& v1, const ivector& v2) {
6006 return sivector(v1) < v2;
6007}
6008
6010inline bool operator<(const srmatrix_subv& v1, const ivector_slice& v2) {
6011 return srvector(v1) < v2;
6012}
6013
6015inline bool operator<(const simatrix_subv& v1, const ivector_slice& v2) {
6016 return sivector(v1) < v2;
6017}
6018
6020inline bool operator<(const srvector& v1, const simatrix_subv& v2) {
6021 return v1 < sivector(v2);
6022}
6023
6025inline bool operator<(const sivector& v1, const simatrix_subv& v2) {
6026 return v1 < sivector(v2);
6027}
6028
6030inline bool operator<(const srvector_slice& v1, const simatrix_subv& v2) {
6031 return v1 < sivector(v2);
6032}
6033
6035inline bool operator<(const sivector_slice& v1, const simatrix_subv& v2) {
6036 return v1 < sivector(v2);
6037}
6038
6040inline bool operator<(const rvector& v1, const simatrix_subv& v2) {
6041 return v1 < sivector(v2);
6042}
6043
6045inline bool operator<(const ivector& v1, const simatrix_subv& v2) {
6046 return v1 < sivector(v2);
6047}
6048
6050inline bool operator<(const rvector_slice& v1, const simatrix_subv& v2) {
6051 return v1 < sivector(v2);
6052}
6053
6055inline bool operator<(const ivector_slice& v1, const simatrix_subv& v2) {
6056 return v1 < sivector(v2);
6057}
6058
6060inline bool operator<=(const srmatrix_subv& v1, const sivector& v2) {
6061 return srvector(v1) <= v2;
6062}
6063
6065inline bool operator<=(const simatrix_subv& v1, const sivector& v2) {
6066 return sivector(v1) <= v2;
6067}
6068
6070inline bool operator<=(const srmatrix_subv& v1, const sivector_slice& v2) {
6071 return srvector(v1) <= v2;
6072}
6073
6075inline bool operator<=(const simatrix_subv& v1, const sivector_slice& v2) {
6076 return sivector(v1) <= v2;
6077}
6078
6080inline bool operator<=(const srmatrix_subv& v1, const ivector& v2) {
6081 return srvector(v1) <= v2;
6082}
6083
6085inline bool operator<=(const simatrix_subv& v1, const ivector& v2) {
6086 return sivector(v1) <= v2;
6087}
6088
6090inline bool operator<=(const srmatrix_subv& v1, const ivector_slice& v2) {
6091 return srvector(v1) <= v2;
6092}
6093
6095inline bool operator<=(const simatrix_subv& v1, const ivector_slice& v2) {
6096 return sivector(v1) <= v2;
6097}
6098
6100inline bool operator<=(const srvector& v1, const simatrix_subv& v2) {
6101 return v1 <= sivector(v2);
6102}
6103
6105inline bool operator<=(const sivector& v1, const simatrix_subv& v2) {
6106 return v1 <= sivector(v2);
6107}
6108
6110inline bool operator<=(const srvector_slice& v1, const simatrix_subv& v2) {
6111 return v1 <= sivector(v2);
6112}
6113
6115inline bool operator<=(const sivector_slice& v1, const simatrix_subv& v2) {
6116 return v1 <= sivector(v2);
6117}
6118
6120inline bool operator<=(const rvector& v1, const simatrix_subv& v2) {
6121 return v1 <= sivector(v2);
6122}
6123
6125inline bool operator<=(const ivector& v1, const simatrix_subv& v2) {
6126 return v1 <= sivector(v2);
6127}
6128
6130inline bool operator<=(const rvector_slice& v1, const simatrix_subv& v2) {
6131 return v1 <= sivector(v2);
6132}
6133
6135inline bool operator<=(const ivector_slice& v1, const simatrix_subv& v2) {
6136 return v1 <= sivector(v2);
6137}
6138
6140inline bool operator>(const simatrix_subv& v1, const srvector& v2) {
6141 return sivector(v1) > v2;
6142}
6143
6145inline bool operator>(const simatrix_subv& v1, const sivector& v2) {
6146 return sivector(v1) > v2;
6147}
6148
6150inline bool operator>(const simatrix_subv& v1, const srvector_slice& v2) {
6151 return sivector(v1) > v2;
6152}
6153
6155inline bool operator>(const simatrix_subv& v1, const sivector_slice& v2) {
6156 return sivector(v1) > v2;
6157}
6158
6160inline bool operator>(const simatrix_subv& v1, const rvector& v2) {
6161 return sivector(v1) > v2;
6162}
6163
6165inline bool operator>(const simatrix_subv& v1, const ivector& v2) {
6166 return sivector(v1) > v2;
6167}
6168
6170inline bool operator>(const simatrix_subv& v1, const rvector_slice& v2) {
6171 return sivector(v1) > v2;
6172}
6173
6175inline bool operator>(const simatrix_subv& v1, const ivector_slice& v2) {
6176 return sivector(v1) > v2;
6177}
6178
6180inline bool operator>(const sivector& v1, const srmatrix_subv& v2) {
6181 return v1 > srvector(v2);
6182}
6183
6185inline bool operator>(const sivector& v1, const simatrix_subv& v2) {
6186 return v1 > sivector(v2);
6187}
6188
6190inline bool operator>(const sivector_slice& v1, const srmatrix_subv& v2) {
6191 return v1 > srvector(v2);
6192}
6193
6195inline bool operator>(const sivector_slice& v1, const simatrix_subv& v2) {
6196 return v1 > sivector(v2);
6197}
6198
6200inline bool operator>(const ivector& v1, const srmatrix_subv& v2) {
6201 return v1 > srvector(v2);
6202}
6203
6205inline bool operator>(const ivector& v1, const simatrix_subv& v2) {
6206 return v1 > sivector(v2);
6207}
6208
6210inline bool operator>(const ivector_slice& v1, const srmatrix_subv& v2) {
6211 return v1 > srvector(v2);
6212}
6213
6215inline bool operator>(const ivector_slice& v1, const simatrix_subv& v2) {
6216 return v1 > sivector(v2);
6217}
6218
6220inline bool operator>=(const simatrix_subv& v1, const srvector& v2) {
6221 return sivector(v1) >= v2;
6222}
6223
6225inline bool operator>=(const simatrix_subv& v1, const sivector& v2) {
6226 return sivector(v1) >= v2;
6227}
6228
6230inline bool operator>=(const simatrix_subv& v1, const srvector_slice& v2) {
6231 return sivector(v1) >= v2;
6232}
6233
6235inline bool operator>=(const simatrix_subv& v1, const sivector_slice& v2) {
6236 return sivector(v1) >= v2;
6237}
6238
6240inline bool operator>=(const simatrix_subv& v1, const rvector& v2) {
6241 return sivector(v1) >= v2;
6242}
6243
6245inline bool operator>=(const simatrix_subv& v1, const ivector& v2) {
6246 return sivector(v1) >= v2;
6247}
6248
6250inline bool operator>=(const simatrix_subv& v1, const rvector_slice& v2) {
6251 return sivector(v1) >= v2;
6252}
6253
6255inline bool operator>=(const simatrix_subv& v1, const ivector_slice& v2) {
6256 return sivector(v1) >= v2;
6257}
6258
6260inline bool operator>=(const sivector& v1, const srmatrix_subv& v2) {
6261 return v1 >= srvector(v2);
6262}
6263
6265inline bool operator>=(const sivector& v1, const simatrix_subv& v2) {
6266 return v1 >= sivector(v2);
6267}
6268
6270inline bool operator>=(const sivector_slice& v1, const srmatrix_subv& v2) {
6271 return v1 >= srvector(v2);
6272}
6273
6275inline bool operator>=(const sivector_slice& v1, const simatrix_subv& v2) {
6276 return v1 >= sivector(v2);
6277}
6278
6280inline bool operator>=(const ivector& v1, const srmatrix_subv& v2) {
6281 return v1 >= srvector(v2);
6282}
6283
6285inline bool operator>=(const ivector& v1, const simatrix_subv& v2) {
6286 return v1 >= sivector(v2);
6287}
6288
6290inline bool operator>=(const ivector_slice& v1, const srmatrix_subv& v2) {
6291 return v1 >= srvector(v2);
6292}
6293
6295inline bool operator>=(const ivector_slice& v1, const simatrix_subv& v2) {
6296 return v1 >= sivector(v2);
6297}
6298
6300inline bool operator!(const simatrix_subv& x) {
6301 return sv_v_not(x);
6302}
6303
6305
6308inline void accumulate(idotprecision& dot, const simatrix_subv& v1, const simatrix_subv& v2) {
6309 spsp_vv_accu<idotprecision,sivector,sivector,sparse_idot>(dot, sivector(v1), sivector(v2));
6310}
6311
6313
6316inline void accumulate(idotprecision& dot, const simatrix_subv& v1, const srmatrix_subv& v2) {
6317 spsp_vv_accu<idotprecision,sivector,srvector,sparse_idot>(dot, sivector(v1), srvector(v2));
6318}
6319
6321
6324inline void accumulate(idotprecision& dot, const srmatrix_subv& v1, const simatrix_subv& v2) {
6325 spsp_vv_accu<idotprecision,srvector,sivector,sparse_idot>(dot, srvector(v1), sivector(v2));
6326}
6327
6329
6332inline void accumulate(idotprecision& dot, const simatrix_subv& v1, const sivector& v2) {
6333 spsp_vv_accu<idotprecision,sivector,sivector,sparse_idot>(dot, sivector(v1), v2);
6334}
6335
6337
6340inline void accumulate(idotprecision& dot, const simatrix_subv& v1, const srvector& v2) {
6341 spsp_vv_accu<idotprecision,sivector,srvector,sparse_idot>(dot, sivector(v1), v2);
6342}
6343
6345
6348inline void accumulate(idotprecision& dot, const srmatrix_subv& v1, const sivector& v2) {
6349 spsp_vv_accu<idotprecision,srvector,sivector,sparse_idot>(dot, srvector(v1), v2);
6350}
6351
6353
6356inline void accumulate(idotprecision& dot, const simatrix_subv& v1, const sivector_slice& v2) {
6357 spsl_vv_accu<idotprecision,sivector,sivector_slice,sparse_idot>(dot, sivector(v1), v2);
6358}
6359
6361
6364inline void accumulate(idotprecision& dot, const simatrix_subv& v1, const srvector_slice& v2) {
6365 spsl_vv_accu<idotprecision,sivector,srvector_slice,sparse_idot>(dot, sivector(v1), v2);
6366}
6367
6369
6372inline void accumulate(idotprecision& dot, const srmatrix_subv& v1, const sivector_slice& v2) {
6373 spsl_vv_accu<idotprecision,srvector,sivector_slice,sparse_idot>(dot, srvector(v1), v2);
6374}
6375
6377
6380inline void accumulate(idotprecision& dot, const simatrix_subv& v1, const ivector& v2) {
6381 spf_vv_accu<idotprecision,sivector,ivector,sparse_idot>(dot, sivector(v1), v2);
6382}
6383
6385
6388inline void accumulate(idotprecision& dot, const simatrix_subv& v1, const rvector& v2) {
6389 spf_vv_accu<idotprecision,sivector,rvector,sparse_idot>(dot, sivector(v1), v2);
6390}
6391
6393
6396inline void accumulate(idotprecision& dot, const srmatrix_subv& v1, const ivector& v2) {
6397 spf_vv_accu<idotprecision,srvector,ivector,sparse_idot>(dot, srvector(v1), v2);
6398}
6399
6401
6404inline void accumulate(idotprecision& dot, const simatrix_subv& v1, const ivector_slice& v2) {
6405 spf_vv_accu<idotprecision,sivector,ivector_slice,sparse_idot>(dot, sivector(v1), v2);
6406}
6407
6409
6412inline void accumulate(idotprecision& dot, const simatrix_subv& v1, const rvector_slice& v2) {
6413 spf_vv_accu<idotprecision,sivector,rvector_slice,sparse_idot>(dot, sivector(v1), v2);
6414}
6415
6417
6420inline void accumulate(idotprecision& dot, const srmatrix_subv& v1, const ivector_slice& v2) {
6421 spf_vv_accu<idotprecision,srvector,ivector_slice,sparse_idot>(dot, srvector(v1), v2);
6422}
6423
6425
6428inline void accumulate(idotprecision& dot, const sivector& v1, const simatrix_subv& v2) {
6429 spsp_vv_accu<idotprecision,sivector,sivector,sparse_idot>(dot, v1, sivector(v2));
6430}
6431
6433
6436inline void accumulate(idotprecision& dot, const sivector& v1, const srmatrix_subv& v2) {
6437 spsp_vv_accu<idotprecision,sivector,srvector,sparse_idot>(dot, v1, srvector(v2));
6438}
6439
6441
6444inline void accumulate(idotprecision& dot, const srvector& v1, const simatrix_subv& v2) {
6445 spsp_vv_accu<idotprecision,srvector,sivector,sparse_idot>(dot, v1, sivector(v2));
6446}
6447
6449
6452inline void accumulate(idotprecision& dot, const sivector_slice& v1, const simatrix_subv& v2) {
6453 slsp_vv_accu<idotprecision,sivector_slice,sivector,sparse_idot>(dot, v1, sivector(v2));
6454}
6455
6457
6460inline void accumulate(idotprecision& dot, const sivector_slice& v1, const srmatrix_subv& v2) {
6461 slsp_vv_accu<idotprecision,sivector_slice,srvector,sparse_idot>(dot, v1, srvector(v2));
6462}
6463
6465
6468inline void accumulate(idotprecision& dot, const srvector_slice& v1, const simatrix_subv& v2) {
6469 slsp_vv_accu<idotprecision,srvector_slice,sivector,sparse_idot>(dot, v1, sivector(v2));
6470}
6471
6473
6476inline void accumulate(idotprecision& dot, const ivector& v1, const simatrix_subv& v2) {
6477 fsp_vv_accu<idotprecision,ivector,sivector,sparse_idot>(dot, v1, sivector(v2));
6478}
6479
6481
6484inline void accumulate(idotprecision& dot, const ivector& v1, const srmatrix_subv& v2) {
6485 fsp_vv_accu<idotprecision,ivector,srvector,sparse_idot>(dot, v1, srvector(v2));
6486}
6487
6489
6492inline void accumulate(idotprecision& dot, const rvector& v1, const simatrix_subv& v2) {
6493 fsp_vv_accu<idotprecision,rvector,sivector,sparse_idot>(dot, v1, sivector(v2));
6494}
6495
6497
6500inline void accumulate(idotprecision& dot, const ivector_slice& v1, const simatrix_subv& v2) {
6501 fsp_vv_accu<idotprecision,ivector_slice,sivector,sparse_idot>(dot, v1, sivector(v2));
6502}
6503
6505
6508inline void accumulate(idotprecision& dot, const ivector_slice& v1, const srmatrix_subv& v2) {
6509 fsp_vv_accu<idotprecision,ivector_slice,srvector,sparse_idot>(dot, v1, srvector(v2));
6510}
6511
6513
6516inline void accumulate(idotprecision& dot, const rvector_slice& v1, const simatrix_subv& v2) {
6517 fsp_vv_accu<idotprecision,rvector_slice,sivector,sparse_idot>(dot, v1, sivector(v2));
6518}
6519
6521
6524inline void accumulate(cidotprecision& dot, const simatrix_subv& v1, const simatrix_subv& v2) {
6525 idotprecision tmp(0.0);
6526 tmp.set_k(dot.get_k());
6527 accumulate(tmp,sivector(v1),sivector(v2));
6528 SetRe(dot, Re(dot) + tmp);
6529}
6530
6532
6535inline void accumulate(cidotprecision& dot, const simatrix_subv& v1, const srmatrix_subv& v2) {
6536 idotprecision tmp(0.0);
6537 tmp.set_k(dot.get_k());
6538 accumulate(tmp,sivector(v1),srvector(v2));
6539 SetRe(dot, Re(dot) + tmp);
6540}
6541
6543
6546inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const simatrix_subv& v2) {
6547 idotprecision tmp(0.0);
6548 tmp.set_k(dot.get_k());
6549 accumulate(tmp,srvector(v1),sivector(v2));
6550 SetRe(dot, Re(dot) + tmp);
6551}
6552
6554
6557inline void accumulate(cidotprecision& dot, const simatrix_subv& v1, const sivector& v2) {
6558 idotprecision tmp(0.0);
6559 tmp.set_k(dot.get_k());
6560 accumulate(tmp,sivector(v1),v2);
6561 SetRe(dot, Re(dot) + tmp);
6562}
6563
6565
6568inline void accumulate(cidotprecision& dot, const simatrix_subv& v1, const srvector& v2) {
6569 idotprecision tmp(0.0);
6570 tmp.set_k(dot.get_k());
6571 accumulate(tmp,sivector(v1),v2);
6572 SetRe(dot, Re(dot) + tmp);
6573}
6574
6576
6579inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const sivector& v2) {
6580 idotprecision tmp(0.0);
6581 tmp.set_k(dot.get_k());
6582 accumulate(tmp,srvector(v1),v2);
6583 SetRe(dot, Re(dot) + tmp);
6584}
6585
6587
6590inline void accumulate(cidotprecision& dot, const simatrix_subv& v1, const sivector_slice& v2) {
6591 idotprecision tmp(0.0);
6592 tmp.set_k(dot.get_k());
6593 accumulate(tmp,sivector(v1),v2);
6594 SetRe(dot, Re(dot) + tmp);
6595}
6596
6598
6601inline void accumulate(cidotprecision& dot, const simatrix_subv& v1, const srvector_slice& v2) {
6602 idotprecision tmp(0.0);
6603 tmp.set_k(dot.get_k());
6604 accumulate(tmp,sivector(v1),v2);
6605 SetRe(dot, Re(dot) + tmp);
6606}
6607
6609
6612inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const sivector_slice& v2) {
6613 idotprecision tmp(0.0);
6614 tmp.set_k(dot.get_k());
6615 accumulate(tmp,srvector(v1),v2);
6616 SetRe(dot, Re(dot) + tmp);
6617}
6618
6620
6623inline void accumulate(cidotprecision& dot, const simatrix_subv& v1, const ivector& v2) {
6624 idotprecision tmp(0.0);
6625 tmp.set_k(dot.get_k());
6626 accumulate(tmp,sivector(v1),v2);
6627 SetRe(dot, Re(dot) + tmp);
6628}
6629
6631
6634inline void accumulate(cidotprecision& dot, const simatrix_subv& v1, const rvector& v2) {
6635 idotprecision tmp(0.0);
6636 tmp.set_k(dot.get_k());
6637 accumulate(tmp,sivector(v1),v2);
6638 SetRe(dot, Re(dot) + tmp);
6639}
6640
6642
6645inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const ivector& v2) {
6646 idotprecision tmp(0.0);
6647 tmp.set_k(dot.get_k());
6648 accumulate(tmp,srvector(v1),v2);
6649 SetRe(dot, Re(dot) + tmp);
6650}
6651
6653
6656inline void accumulate(cidotprecision& dot, const simatrix_subv& v1, const ivector_slice& v2) {
6657 idotprecision tmp(0.0);
6658 tmp.set_k(dot.get_k());
6659 accumulate(tmp,sivector(v1),v2);
6660 SetRe(dot, Re(dot) + tmp);
6661}
6662
6664
6667inline void accumulate(cidotprecision& dot, const simatrix_subv& v1, const rvector_slice& v2) {
6668 idotprecision tmp(0.0);
6669 tmp.set_k(dot.get_k());
6670 accumulate(tmp,sivector(v1),v2);
6671 SetRe(dot, Re(dot) + tmp);
6672}
6673
6675
6678inline void accumulate(cidotprecision& dot, const srmatrix_subv& v1, const ivector_slice& v2) {
6679 idotprecision tmp(0.0);
6680 tmp.set_k(dot.get_k());
6681 accumulate(tmp,srvector(v1),v2);
6682 SetRe(dot, Re(dot) + tmp);
6683}
6684
6686
6689inline void accumulate(cidotprecision& dot, const sivector& v1, const simatrix_subv& v2) {
6690 idotprecision tmp(0.0);
6691 tmp.set_k(dot.get_k());
6692 accumulate(tmp,v1,sivector(v2));
6693 SetRe(dot, Re(dot) + tmp);
6694}
6695
6697
6700inline void accumulate(cidotprecision& dot, const sivector& v1, const srmatrix_subv& v2) {
6701 idotprecision tmp(0.0);
6702 tmp.set_k(dot.get_k());
6703 accumulate(tmp,v1,srvector(v2));
6704 SetRe(dot, Re(dot) + tmp);
6705}
6706
6708
6711inline void accumulate(cidotprecision& dot, const srvector& v1, const simatrix_subv& v2) {
6712 idotprecision tmp(0.0);
6713 tmp.set_k(dot.get_k());
6714 accumulate(tmp,v1,sivector(v2));
6715 SetRe(dot, Re(dot) + tmp);
6716}
6717
6719
6722inline void accumulate(cidotprecision& dot, const sivector_slice& v1, const simatrix_subv& v2) {
6723 idotprecision tmp(0.0);
6724 tmp.set_k(dot.get_k());
6725 accumulate(tmp,v1,sivector(v2));
6726 SetRe(dot, Re(dot) + tmp);
6727}
6728
6730
6733inline void accumulate(cidotprecision& dot, const sivector_slice& v1, const srmatrix_subv& v2) {
6734 idotprecision tmp(0.0);
6735 tmp.set_k(dot.get_k());
6736 accumulate(tmp,v1,srvector(v2));
6737 SetRe(dot, Re(dot) + tmp);
6738}
6739
6741
6744inline void accumulate(cidotprecision& dot, const srvector_slice& v1, const simatrix_subv& v2) {
6745 idotprecision tmp(0.0);
6746 tmp.set_k(dot.get_k());
6747 accumulate(tmp,v1,sivector(v2));
6748 SetRe(dot, Re(dot) + tmp);
6749}
6750
6752
6755inline void accumulate(cidotprecision& dot, const ivector& v1, const simatrix_subv& v2) {
6756 idotprecision tmp(0.0);
6757 tmp.set_k(dot.get_k());
6758 accumulate(tmp,v1,sivector(v2));
6759 SetRe(dot, Re(dot) + tmp);
6760}
6761
6763
6766inline void accumulate(cidotprecision& dot, const ivector& v1, const srmatrix_subv& v2) {
6767 idotprecision tmp(0.0);
6768 tmp.set_k(dot.get_k());
6769 accumulate(tmp,v1,srvector(v2));
6770 SetRe(dot, Re(dot) + tmp);
6771}
6772
6774
6777inline void accumulate(cidotprecision& dot, const rvector& v1, const simatrix_subv& v2) {
6778 idotprecision tmp(0.0);
6779 tmp.set_k(dot.get_k());
6780 accumulate(tmp,v1,sivector(v2));
6781 SetRe(dot, Re(dot) + tmp);
6782}
6783
6785
6788inline void accumulate(cidotprecision& dot, const ivector_slice& v1, const simatrix_subv& v2) {
6789 idotprecision tmp(0.0);
6790 tmp.set_k(dot.get_k());
6791 accumulate(tmp,v1,sivector(v2));
6792 SetRe(dot, Re(dot) + tmp);
6793}
6794
6796
6799inline void accumulate(cidotprecision& dot, const ivector_slice& v1, const srmatrix_subv& v2) {
6800 idotprecision tmp(0.0);
6801 tmp.set_k(dot.get_k());
6802 accumulate(tmp,v1,srvector(v2));
6803 SetRe(dot, Re(dot) + tmp);
6804}
6805
6807
6810inline void accumulate(cidotprecision& dot, const rvector_slice& v1, const simatrix_subv& v2) {
6811 idotprecision tmp(0.0);
6812 tmp.set_k(dot.get_k());
6813 accumulate(tmp,v1,sivector(v2));
6814 SetRe(dot, Re(dot) + tmp);
6815}
6816
6817} //namespace cxsc;
6818
6819#include "sparsematrix.inl"
6820
6821#endif
6822
The Data Type cidotprecision.
Definition cidot.hpp:58
int get_k() const
Get currently set precision for computation of dot products.
Definition cidot.hpp:89
The Data Type cimatrix.
Definition cimatrix.hpp:908
The Data Type idotprecision.
Definition idot.hpp:48
void set_k(unsigned int i)
Set precision for computation of dot products.
Definition idot.hpp:88
The Data Type imatrix_slice.
Definition imatrix.hpp:1442
imatrix_slice & operator+=(const imatrix &m1) noexcept
Implementation of addition and allocation operation.
Definition imatrix.inl:1352
imatrix_slice & operator|=(const imatrix &m1) noexcept
Allocates the convex hull of the arguments to the first argument.
Definition imatrix.inl:1508
imatrix_slice & operator&=(const imatrix &m1) noexcept
Allocates the intersection of the arguments to the first argument.
Definition imatrix.inl:1564
imatrix_slice & operator-=(const imatrix &m1) noexcept
Implementation of subtraction and allocation operation.
Definition imatrix.inl:1410
imatrix_slice & operator*=(const imatrix &m) noexcept
Implementation of multiplication and allocation operation.
Definition imatrix.inl:1094
The Data Type imatrix_subv.
Definition imatrix.hpp:56
imatrix_subv & operator|=(const sivector &rv)
Implementation of addition and allocation operation.
imatrix_subv & operator+=(const interval &c) noexcept
Implementation of addition and allocation operation.
Definition imatrix.inl:492
imatrix_subv & operator-=(const interval &c) noexcept
Implementation of subtraction and allocation operation.
Definition imatrix.inl:493
imatrix_subv & operator&=(const sivector &rv)
Implementation of subtraction and allocation operation.
imatrix_subv & operator=(const simatrix_subv &rv)
Implementation of standard assigning operator.
The Data Type imatrix.
Definition imatrix.hpp:660
imatrix & operator+=(const simatrix &)
Implementation of addition and assignment operator.
imatrix & operator=(const interval &r) noexcept
Implementation of standard assigning operator.
Definition imatrix.inl:416
imatrix() noexcept
Constructor of class imatrix.
Definition imatrix.inl:31
imatrix & operator&=(const simatrix &)
Implementation of intersection and assignment operator.
imatrix & operator-=(const simatrix &)
Implementation of substraction and assignment operator.
imatrix & operator*=(const simatrix &)
Implementation of product and assignment operator.
imatrix & operator|=(const simatrix &)
Implementation of convex hull and assignment operator.
The Scalar Type interval.
Definition interval.hpp:55
The Data Type intmatrix.
The Data Type intvector.
Definition intvector.hpp:52
The Data Type ivector_slice.
Definition ivector.hpp:963
The Data Type ivector.
Definition ivector.hpp:55
The Scalar Type real.
Definition real.hpp:114
The Data Type rmatrix_slice.
Definition rmatrix.hpp:1443
The Data Type rmatrix.
Definition rmatrix.hpp:471
The Data Type rvector_slice.
Definition rvector.hpp:1064
The Data Type rvector.
Definition rvector.hpp:58
A slice of a sparse complex interval matrix.
Represents a row or column vector of a sparse matrix.
A sparse complex interval matrix.
Definition scimatrix.hpp:71
A sparse complex interval vector.
Definition scivector.hpp:62
A slice of a sparse real interval matrix.
simatrix_slice & operator+=(const rmatrix &M)
Assigns the element wise sum of the sparse slice and M to the slice.
friend int ColLen(const simatrix_slice &)
Returns the number of rows of the matrix slice.
simatrix_slice & operator|=(const imatrix &M)
Assigns the element wise convex hull of the sparse slice and M to the slice.
simatrix_slice & operator|=(const rmatrix &M)
Assigns the element wise convex hull of the sparse slice and M to the slice.
simatrix_slice & operator|=(const simatrix_slice &M)
Assigns the element wise convex hull of the sparse slice and M to the slice.
simatrix_slice & operator*=(const imatrix &M)
Assigns the product of the sparse slice and M to the slice.
simatrix_slice & operator=(const srmatrix &C)
Assing C to the slice.
simatrix_slice & operator|=(const simatrix &M)
Assigns the element wise convex hull of the sparse slice and M to the slice.
simatrix_slice & operator/=(const real &r)
Assigns the component wise division of the sparse slice and M to the slice.
simatrix_slice & operator-=(const srmatrix &M)
Assigns the element wise difference of the sparse slice and M to the slice.
simatrix_slice & operator|=(const srmatrix_slice &M)
Assigns the element wise convex hull of the sparse slice and M to the slice.
interval & element(const int i, const int j)
Returns a reference to the element (i,j) of the matrix.
simatrix_slice & operator=(const rmatrix &C)
Assing C to the slice.
simatrix_slice & operator*=(const simatrix_slice &M)
Assigns the product of the sparse slice and M to the slice.
simatrix_slice & operator-=(const imatrix &M)
Assigns the element wise difference of the sparse slice and M to the slice.
friend srmatrix diam(const simatrix_slice &)
Returns the elementwise diameter of S.
simatrix_slice & operator=(const real &C)
Assing C to all elements of the slice.
simatrix_slice & operator=(const interval &C)
Assing C to all elements of the slice.
simatrix_slice & operator-=(const rmatrix &M)
Assigns the element wise difference of the sparse slice and M to the slice.
simatrix_slice & operator+=(const srmatrix_slice &M)
Assigns the element wise sum of the sparse slice and M to the slice.
friend int Lb(const simatrix_slice &, const int)
Returns the lower index bound of the rows (if i==ROW) or columns (if i==COL) of the slice.
simatrix_slice & operator+=(const simatrix_slice &M)
Assigns the element wise sum of the sparse slice and M to the slice.
simatrix_slice & operator=(const srmatrix_slice &C)
Assing C to the slice.
simatrix_slice & operator*=(const imatrix_slice &M)
Assigns the product of the sparse slice and M to the slice.
friend int Ub(const simatrix_slice &, const int)
Returns the upper index bound of the rows (if i==ROW) or columns (if i==COL) of the slice.
friend int RowLen(const simatrix_slice &)
Returns the number columns of the matrix slice.
simatrix_slice & operator=(const simatrix &C)
Assing C to the slice.
friend simatrix abs(const simatrix_slice &)
Returns the elementwise absolute value of S.
simatrix_slice & operator*=(const srmatrix_slice &M)
Assigns the product of the sparse slice and M to the slice.
simatrix_slice & operator-=(const srmatrix_slice &M)
Assigns the element wise difference of the sparse slice and M to the slice.
simatrix_slice & operator-=(const simatrix_slice &M)
Assigns the element wise difference of the sparse slice and M to the slice.
simatrix_subv operator[](const int)
Returns a row of the matrix.
simatrix_slice & operator=(const imatrix &C)
Assing C to the slice.
simatrix_slice & operator+=(const srmatrix &M)
Assigns the element wise sum of the sparse slice and M to the slice.
simatrix_slice & operator-=(const simatrix &M)
Assigns the element wise difference of the sparse slice and M to the slice.
simatrix_slice & operator+=(const imatrix_slice &M)
Assigns the element wise sum of the sparse slice and M to the slice.
simatrix_slice & operator=(const rmatrix_slice &C)
Assing C to the slice.
simatrix_slice & operator=(const imatrix_slice &C)
Assing C to the slice.
simatrix_slice & operator+=(const simatrix &M)
Assigns the element wise sum of the sparse slice and M to the slice.
simatrix_slice & operator*=(const interval &r)
Assigns the component wise product of the sparse slice and r to the slice.
simatrix_slice & operator*=(const real &r)
Assigns the component wise product of the sparse slice and r to the slice.
simatrix_slice & operator*=(const simatrix &M)
Assigns the product of the sparse slice and M to the slice.
const interval operator()(const int i, const int j) const
Returns a copy of the element (i,j) of the matrix.
simatrix_slice & operator*=(const srmatrix &M)
Assigns the product of the sparse slice and M to the slice.
simatrix_slice & operator-=(const rmatrix_slice &M)
Assigns the element wise difference of the sparse slice and M to the slice.
friend srmatrix Sup(const simatrix_slice &)
Returns the supremum of the slice S.
friend srmatrix mid(const simatrix_slice &)
Returns the elementwise midpoint of S.
simatrix_slice & operator*=(const rmatrix_slice &M)
Assigns the product of the sparse slice and M to the slice.
friend srmatrix Inf(const simatrix_slice &)
Returns the infimum of the slice S.
simatrix_slice & operator|=(const rmatrix_slice &M)
Assigns the element wise convex hull of the sparse slice and M to the slice.
simatrix_slice & operator*=(const rmatrix &M)
Assigns the product of the sparse slice and M to the slice.
simatrix_slice & operator|=(const imatrix_slice &M)
Assigns the element wise convex hull of the sparse slice and M to the slice.
simatrix_slice & operator+=(const imatrix &M)
Assigns the element wise sum of the sparse slice and M to the slice.
simatrix_slice & operator=(const simatrix_slice &C)
Assing C to the slice.
simatrix_slice & operator|=(const srmatrix &M)
Assigns the element wise convex hull of the sparse slice and M to the slice.
simatrix_slice & operator/=(const interval &r)
Assigns the component wise division of the sparse slice and M to the slice.
simatrix_slice & operator-=(const imatrix_slice &M)
Assigns the element wise difference of the sparse slice and M to the slice.
friend std::ostream & operator<<(std::ostream &, const simatrix_slice &)
Standard output operator for sparse matrix slice.
simatrix_slice & operator+=(const rmatrix_slice &M)
Assigns the element wise sum of the sparse slice and M to the slice.
Represents a row or column vector of a sparse matrix.
simatrix_subv & operator=(const ivector &v)
Assigns a vector to a subvector.
friend srvector Sup(const simatrix_subv &)
Returns the supremum of the subvector.
simatrix_subv & operator=(const rvector_slice &v)
Assigns a vector to a subvector.
friend sivector operator-(const simatrix_subv &)
Unary negation operator.
friend int Ub(const simatrix_subv &)
Returns the upper index bound of the subvector.
simatrix_subv & operator+=(const srvector &)
Assign the sum of the subvector with a vector to the subvector.
simatrix_subv & operator=(const simatrix_subv &v)
Assigns a vector to a subvector.
simatrix_subv & operator=(const sivector &v)
Assigns a vector to a subvector.
simatrix_subv & operator=(const srvector &v)
Assigns a vector to a subvector.
simatrix_subv & operator=(const ivector_slice &v)
Assigns a vector to a subvector.
simatrix_subv & operator|=(const srvector &)
Assign the convex hull of the subvector and a vector to the subvector.
simatrix_subv & operator=(const srvector_slice &v)
Assigns a vector to a subvector.
const interval operator[](const int i) const
Returns a copy of the i-th element of the subvector.
friend int Lb(const simatrix_subv &)
Returns the lower index bound of the subvector.
friend srvector Inf(const simatrix_subv &)
Returns the infimum of the subvector.
simatrix_subv & operator*=(const real &)
Assign the componentwise product of the subvector with a scalar to the subvector.
simatrix_subv & operator=(const interval &v)
Assigns v to all elements of the subvector.
friend std::istream & operator>>(std::istream &, simatrix_subv &)
Standard input operator for subvectors.
friend int VecLen(const simatrix_subv &)
Returns the length of the subvector.
simatrix_subv & operator=(const sivector_slice &v)
Assigns a vector to a subvector.
simatrix_subv & operator=(const real &v)
Assigns v to all elements of the subvector.
simatrix_subv & operator-=(const srvector &)
Assign the difference of the subvector with a vector to the subvector.
simatrix_subv & operator/=(const real &)
Assign the componentwise division of the subvector with a scalar to the subvector.
simatrix_subv & operator=(const srmatrix_subv &v)
Assigns a vector to a subvector.
interval & operator[](const int i)
Returns a reference to the i-th element of the subvector.
simatrix_subv & operator=(const rvector &v)
Assigns a vector to a subvector.
A sparse interval matrix.
Definition simatrix.hpp:69
simatrix(const imatrix &A)
Creates a sparse matrix out of a dense matrix A. Only the non zero elements of A are stored explicitl...
Definition simatrix.hpp:390
int get_nnz() const
Returns the number of non-zero entries (including explicitly stored zeros).
Definition simatrix.hpp:684
void dropzeros()
Drops explicitly stored zeros from the data structure.
Definition simatrix.hpp:473
simatrix & operator-=(const imatrix &B)
Subtract B from the sparse matrix and assign the result to it.
Definition simatrix.hpp:724
simatrix & operator*=(const srmatrix &B)
Multiply the sparse matrix by B and assign the result to it.
Definition simatrix.hpp:769
simatrix & operator&=(const simatrix &B)
Form the convex hull of a sparse matrix and B and assign the result to it.
Definition simatrix.hpp:839
simatrix & operator|=(const srmatrix &B)
Form the convex hull of a sparse matrix and B and assign the result to it.
Definition simatrix.hpp:819
friend srmatrix absmin(const simatrix &)
Returns the componentwise minimum absolute value.
simatrix(const int m, const int n, const int nnz, const intvector &rows, const intvector &cols, const ivector &values, const enum STORAGE_TYPE t=triplet)
Creates a sparse matrix out of three vectors (arrays) forming a matrix stored in triplet,...
Definition simatrix.hpp:143
simatrix & operator*=(const interval &r)
Multiply all elements of the sparse matrix by r and assign the result to it.
Definition simatrix.hpp:784
friend srmatrix Inf(const simatrix &)
Returns the Infimum of the matrix A.
friend void SetLb(simatrix &, const int, const int)
Sets the lower index bound of the rows (i==ROW) or columns (i==COL) to j.
Definition simatrix.hpp:974
simatrix & operator=(const rmatrix_slice &A)
Assigns a dense matrix slice to the sparse matrix. Only the non zero entries of the dense matrix are ...
Definition simatrix.hpp:517
std::vector< int > & row_indices()
Returns a reference to the vector containing the row indices (the array)
Definition simatrix.hpp:87
simatrix & operator+=(const rmatrix &B)
Add B to the sparse matrix and assign the result to it.
Definition simatrix.hpp:689
friend simatrix Id(const simatrix &)
Return a sparse unity matrix of the same dimension as A.
Definition simatrix.hpp:911
friend int ColLen(const simatrix &)
Returns the number of rows of the matrix.
void full(imatrix &A) const
Creates a full matrix out of the sparse matrix and stores it in A. This should normally be done using...
Definition simatrix.hpp:458
simatrix & operator=(const real &A)
Assigns a real value to all elements of the matrix (resulting in a dense matrix!)
Definition simatrix.hpp:497
simatrix & operator*=(const rmatrix &B)
Multiply the sparse matrix by B and assign the result to it.
Definition simatrix.hpp:754
simatrix operator()(const intvector &pervec, const intvector &q)
Performs a row and column permutation using two permutation vectors.
Definition simatrix.hpp:615
simatrix & operator*=(const imatrix &B)
Multiply the sparse matrix by B and assign the result to it.
Definition simatrix.hpp:749
friend simatrix abs(const simatrix &)
Returns the componentwise absolute value as the interval hull of .
simatrix & operator-=(const rmatrix_slice &B)
Subtract B from the sparse matrix and assign the result to it.
Definition simatrix.hpp:729
friend srmatrix absmax(const simatrix &)
Returns the componentwise maximum absolute value.
friend int Lb(const simatrix &, int)
Returns the lower index bound for the rows or columns of A.
simatrix(const srmatrix &A)
Creates a sparse interval matrix out of a sparse real matrix A.
Definition simatrix.hpp:359
simatrix & operator|=(const rmatrix &B)
Form the convex hull of a sparse matrix and B and assign the result to it.
Definition simatrix.hpp:799
simatrix & operator|=(const imatrix_slice &B)
Form the convex hull of a sparse matrix and B and assign the result to it.
Definition simatrix.hpp:814
simatrix & operator=(const imatrix_slice &A)
Assigns a dense matrix slice to the sparse matrix. Only the non zero entries of the dense matrix are ...
Definition simatrix.hpp:522
simatrix & operator=(const srmatrix &A)
Assign a sparse real to a sparse interval matrix.
Definition simatrix.hpp:527
simatrix & operator*=(const real &r)
Multiply all elements of the sparse matrix by r and assign the result to it.
Definition simatrix.hpp:779
friend std::istream & operator>>(std::istream &, simatrix_slice &)
Standard input operator for sparse matrix slice.
const std::vector< int > & column_pointers() const
Returns a constant reference to the vector containing the column pointers (the array)
Definition simatrix.hpp:97
simatrix(const int r, const int c, const int e)
Creates an empty matrix with r rows and c columns, pre-reserving space for e elements.
Definition simatrix.hpp:128
std::vector< int > & column_pointers()
Returns a reference to the vector containing the column pointers (the array)
Definition simatrix.hpp:82
simatrix & operator&=(const imatrix_slice &B)
Form the convex hull of a sparse matrix and B and assign the result to it.
Definition simatrix.hpp:834
simatrix & operator-=(const srmatrix &B)
Subtract B from the sparse matrix and assign the result to it.
Definition simatrix.hpp:739
simatrix & operator+=(const simatrix &B)
Add B to the sparse matrix and assign the result to it.
Definition simatrix.hpp:714
simatrix & operator|=(const imatrix &B)
Form the convex hull of a sparse matrix and B and assign the result to it.
Definition simatrix.hpp:804
simatrix & operator+=(const imatrix &B)
Add B to the sparse matrix and assign the result to it.
Definition simatrix.hpp:694
friend int Ub(const simatrix &, int)
Returns the upper index bound for the rows or columns of A.
friend srmatrix diam(const simatrix &)
Returns the componentwise diameter of A.
simatrix & operator+=(const srmatrix &B)
Add B to the sparse matrix and assign the result to it.
Definition simatrix.hpp:709
simatrix & operator+=(const rmatrix_slice &B)
Add B to the sparse matrix and assign the result to it.
Definition simatrix.hpp:699
simatrix & operator/=(const interval &r)
Divide all elements of the sparse matrix by r and assign the result to it.
Definition simatrix.hpp:794
simatrix & operator&=(const imatrix &B)
Form the intersection of a sparse matrix and B and assign the result to it.
Definition simatrix.hpp:829
simatrix & operator|=(const simatrix &B)
Form the convex hull of a sparse matrix and B and assign the result to it.
Definition simatrix.hpp:824
friend simatrix Im(const scimatrix &)
Returns the imaginary part of the matrix A.
simatrix & operator/=(const real &r)
Divide all elements of the sparse matrix by r and assign the result to it.
Definition simatrix.hpp:789
simatrix(const int ms, const int ns, const imatrix &A)
Constructor for banded matrices.
Definition simatrix.hpp:416
friend srmatrix CompMat(const simatrix &)
Returns Ostroswkis comparison matrix for A.
simatrix & operator*=(const imatrix_slice &B)
Multiply the sparse matrix by B and assign the result to it.
Definition simatrix.hpp:764
simatrix & operator-=(const simatrix &B)
Subtract B from the sparse matrix and assign the result to it.
Definition simatrix.hpp:744
const interval operator()(int i, int j) const
Returns a copy of the element in row i and column j.
Definition simatrix.hpp:558
simatrix()
Standard constructor, creates an empty matrix of dimension 0x0.
Definition simatrix.hpp:112
simatrix & operator=(const imatrix &A)
Assigns a dense matrix to the sparse matrix. Only the non zero entries of the dense matrix are used.
Definition simatrix.hpp:512
friend int RowLen(const simatrix &)
Returns the number of columns of the matrix.
friend void SetUb(simatrix &, const int, const int)
Sets the upper index bound of the rows (i==ROW) or columns (i==COL) to j.
Definition simatrix.hpp:989
simatrix operator()(const intmatrix &P, const intmatrix &Q)
Performs row and column permutations using the two permutation matrices P and Q. Faster than explicit...
Definition simatrix.hpp:666
simatrix(const rmatrix &A)
Creates a sparse matrix out of a dense matrix A. Only the non zero elements of A are stored explicitl...
Definition simatrix.hpp:367
friend srmatrix mid(const simatrix &)
Returns the midpoint matrix for A.
simatrix & operator-=(const rmatrix &B)
Subtract B from the sparse matrix and assign the result to it.
Definition simatrix.hpp:719
simatrix & operator*=(const simatrix &B)
Multiply the sparse matrix by B and assign the result to it.
Definition simatrix.hpp:774
const std::vector< int > & row_indices() const
Returns a constant reference to the vector containing the row indices (the array)
Definition simatrix.hpp:102
const std::vector< interval > & values() const
Returns a constant reference to the vector containing the stored values (the array)
Definition simatrix.hpp:107
friend simatrix transp(const simatrix &)
Returns the transpose of A.
Definition simatrix.hpp:934
simatrix & operator-=(const imatrix_slice &B)
Subtract B from the sparse matrix and assign the result to it.
Definition simatrix.hpp:734
real density() const
Returns the density (the number of non-zeros divided by the number of elements) of the matrix.
Definition simatrix.hpp:679
simatrix & operator+=(const imatrix_slice &B)
Add B to the sparse matrix and assign the result to it.
Definition simatrix.hpp:704
simatrix & operator*=(const rmatrix_slice &B)
Multiply the sparse matrix by B and assign the result to it.
Definition simatrix.hpp:759
simatrix & operator=(const rmatrix &A)
Assigns a dense matrix to the sparse matrix. Only the non zero entries of the dense matrix are used.
Definition simatrix.hpp:507
friend simatrix Re(const scimatrix &)
Returns the real part of the matrix A.
simatrix & operator|=(const rmatrix_slice &B)
Form the convex hull of a sparse matrix and B and assign the result to it.
Definition simatrix.hpp:809
simatrix & operator=(const interval &A)
Assigns an interval value to all elements of the matrix (resulting in a dense matrix!...
Definition simatrix.hpp:502
friend srmatrix Sup(const simatrix &)
Returns the Supremum of the matrix A.
std::vector< interval > & values()
Returns a reference to the vector containing the stored values (the array)
Definition simatrix.hpp:92
simatrix operator()(const intmatrix &P)
Performs a row permutation using the permutation matrix P. Faster than explicitly computing the produ...
Definition simatrix.hpp:673
simatrix operator()(const intvector &pervec)
Performs a row permutation using a permutation vector.
Definition simatrix.hpp:642
simatrix(const int m, const int n, const int nnz, const int *rows, const int *cols, const interval *values, const enum STORAGE_TYPE t=triplet)
Creates a sparse matrix out of three arrays forming a matrix stored in triplet, compressed row or com...
Definition simatrix.hpp:254
simatrix(const int r, const int c)
Creates an empty matrix with r rows and c columns, pre-reserving space for 2*(r+c) elements.
Definition simatrix.hpp:119
simatrix_subv operator[](const cxscmatrix_column &)
Returns a column of the matrix as a sparse subvector object.
interval & element(int i, int j)
Returns a reference to the element (i,j) of the matrix.
Definition simatrix.hpp:579
Helper class for slices of sparse vectors.
A sparse interval vector.
Definition sivector.hpp:59
sivector()
Default constructor, creates an empty vector of size 0.
Definition sivector.hpp:69
A slice of a sparse real matrix.
Represents a row or column vector of a sparse matrix.
A sparse real matrix.
Definition srmatrix.hpp:77
void dropzeros()
Drops explicitly stored zeros from the data structure.
Definition srmatrix.hpp:449
int get_nnz() const
Returns the number of non-zero entries (including explicitly stored zeros).
Definition srmatrix.hpp:630
Helper class for slices of sparse vectors.
Definition srvector.hpp:868
A sparse real vector.
Definition srvector.hpp:58
The namespace cxsc, providing all functionality of the class library C-XSC.
Definition cdot.cpp:29
int VecLen(const scimatrix_subv &S)
Returns the length of the subvector.
int ColLen(const cimatrix &)
Returns the column dimension.
rmatrix CompMat(const cimatrix &A)
Returns Ostrowski's comparison matrix.
Definition cimatrix.cpp:45
civector operator/(const cimatrix_subv &rv, const cinterval &s) noexcept
Implementation of division operation.
Definition cimatrix.inl:730
cimatrix transp(const cimatrix &A)
Returns the transposed matrix.
Definition cimatrix.cpp:74
cvector diam(const cimatrix_subv &mv) noexcept
Returns the diameter of the matrix.
Definition cimatrix.inl:738
rvector absmax(const imatrix_subv &mv) noexcept
Returns the absolute maximum value of the matrix.
Definition imatrix.inl:502
int Ub(const cimatrix &rm, const int &i) noexcept
Returns the upper bound index.
cimatrix & SetLb(cimatrix &m, const int &i, const int &j) noexcept
Sets the lower bound index.
int RowLen(const cimatrix &)
Returns the row dimension.
rvector absmin(const imatrix_subv &mv) noexcept
Returns the absolute minimum value of the matrix.
Definition imatrix.inl:496
STORAGE_TYPE
Enumeration depicting the storage type of a sparse matrix (Triplet storage, Compressed column storage...
Definition srmatrix.hpp:42
cimatrix Id(const cimatrix &A)
Returns the Identity matrix.
Definition cimatrix.cpp:61
real AbsMax(const interval &x)
Computes the greatest absolute value .
Definition interval.cpp:303
ivector abs(const cimatrix_subv &mv) noexcept
Returns the absolute value of the matrix.
Definition cimatrix.inl:737
cvector mid(const cimatrix_subv &mv) noexcept
Returns the middle of the matrix.
Definition cimatrix.inl:739
civector operator*(const cimatrix_subv &rv, const cinterval &s) noexcept
Implementation of multiplication operation.
Definition cimatrix.inl:731
void Resize(cimatrix &A) noexcept
Resizes the matrix.
cimatrix & SetUb(cimatrix &m, const int &i, const int &j) noexcept
Sets the upper bound index.
int Lb(const cimatrix &rm, const int &i) noexcept
Returns the lower bound index.
real AbsMin(const interval &x)
Computes the smallest absolute value .
Definition interval.cpp:293