C-XSC - A C++ Class Library for Extended Scientific Computing 2.5.4
intmatrix.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: intmatrix.hpp,v 1.20 2014/01/30 17:23:45 cxsc Exp $ */
25
26#ifndef _CXSC_INTMATRIX_HPP_INCLUDED
27#define _CXSC_INTMATRIX_HPP_INCLUDED
28
29#include "xscclass.hpp"
30
31#include "dot.hpp"
32#include "intvector.hpp"
33#include "except.hpp"
34#include "matrix.hpp"
35
36namespace cxsc {
37
38class intmatrix;
39class intmatrix_slice;
40
42
46{
47 friend class intvector;
48 friend class intmatrix;
49 friend class intmatrix_slice;
50 private:
51 int *dat;
52 int lb,ub;
53 int size,start,offset; // start=first element index 0..n-1
54
55 public:
57 friend INLINE intmatrix_subv Row(intmatrix &m,const int &i)
58#if(CXSC_INDEX_CHECK)
59;
60#else
61 noexcept;
62#endif
64 friend INLINE intmatrix_subv Col(intmatrix &m,const int &i)
65#if(CXSC_INDEX_CHECK)
66;
67#else
68 noexcept;
69#endif
70 friend INLINE intmatrix_subv Row(const intmatrix &m,const int &i)
71#if(CXSC_INDEX_CHECK)
72;
73#else
74 noexcept;
75#endif
77 friend INLINE intmatrix_subv Col(const intmatrix &m,const int &i)
78#if(CXSC_INDEX_CHECK)
79;
80#else
81 noexcept;
82#endif
83//#if(CXSC_INDEX_CHECK)
84#ifdef _CXSC_FRIEND_TPL
85 //----------------- Templates ---------------------------------------
86template <class MV1,class MV2> friend MV1 &_mvmvassign(MV1 &v,const MV2 &rv)
87#if(CXSC_INDEX_CHECK)
88;
89#else
90 noexcept;
91#endif
92template <class MV,class S> friend MV &_mvsassign(MV &v,const S &r) noexcept;
93template <class MV,class V> friend MV &_mvvassign(MV &v,const V &rv)
94#if(CXSC_INDEX_CHECK)
95;
96#else
97 noexcept;
98#endif
99template <class V,class MV2,class S> friend V &_vmvassign(V &v,const MV2 &rv) noexcept;
100template <class MV,class V> friend V _mvabs(const MV &mv) noexcept;
101template <class DP,class V,class SV> friend void _vmvaccu(DP &dp, const V & rv1, const SV &rv2)
102#if(CXSC_INDEX_CHECK)
103 ;
104#else
105 noexcept;
106#endif
107template <class DP,class MV1,class MV2> friend void _mvmvaccu(DP &dp, const MV1 & rv1, const MV2 &rv2)
108#if(CXSC_INDEX_CHECK)
109 ;
110#else
111 noexcept;
112#endif
113 template <class MV,class S,class E> friend E _mvsmult(const MV &rv, const S &s) noexcept;
114 template <class MV1,class MV2,class E> friend E _mvmvplus(const MV1 &rv1, const MV2 &rv2)
115#if(CXSC_INDEX_CHECK)
116 ;
117#else
118 noexcept;
119#endif
120 template <class MV1,class MV2,class E> friend E _mvmvminus(const MV1 &rv1, const MV2 &rv2)
121#if(CXSC_INDEX_CHECK)
122 ;
123#else
124 noexcept;
125#endif
126 template <class MV,class V,class E> friend E _mvvplus(const MV &rv1, const V &rv2)
127#if(CXSC_INDEX_CHECK)
128 ;
129#else
130 noexcept;
131#endif
132 template <class MV,class V,class E> friend E _mvvminus(const MV &rv1, const V &rv2)
133#if(CXSC_INDEX_CHECK)
134 ;
135#else
136 noexcept;
137#endif
138 template <class V,class MV,class E> friend E _vmvminus(const V &rv1, const MV &rv2)
139#if(CXSC_INDEX_CHECK)
140 ;
141#else
142 noexcept;
143#endif
144 template <class MV,class S,class E> friend E _mvsdiv(const MV &rv, const S &s) noexcept;
145template <class MV,class S> friend MV &_mvsmultassign(MV &v,const S &r) noexcept;
146template <class MV, class S> friend MV &_mvsplusassign(MV &v,const S &r) noexcept;
147template <class MV,class S> friend MV &_mvsminusassign(MV &v,const S &r) noexcept;
148template <class MV,class S> friend MV &_mvsdivassign(MV &v,const S &r) noexcept;
149template <class MV,class V> friend MV &_mvvplusassign(MV &v,const V &rv)
150#if(CXSC_INDEX_CHECK)
151;
152#else
153 noexcept;
154#endif
155template <class V,class MV> friend V &_vmvplusassign(V &rv,const MV &v)
156#if(CXSC_INDEX_CHECK)
157;
158#else
159 noexcept;
160#endif
161template <class MV,class V> friend MV &_mvvminusassign(MV &v,const V &rv)
162#if(CXSC_INDEX_CHECK)
163;
164#else
165 noexcept;
166#endif
167template <class V,class MV> friend V &_vmvminusassign(V &rv,const MV &v)
168#if(CXSC_INDEX_CHECK)
169;
170#else
171 noexcept;
172#endif
173
174#endif
175
176 //----------------- Konstruktoren ----------------------------------
177
179 explicit INLINE intmatrix_subv (int *d, const int &l, const int &u, const int &s, const int &st, const int &o) noexcept:dat(d),lb(l),ub(u),size(s),start(st),offset(o) { }
180 public:
182 INLINE intmatrix_subv(const intmatrix_subv &v) noexcept:dat(v.dat),lb(v.lb),ub(v.ub),size(v.size),start(v.start),offset(v.offset) { }
183 public:
184
185 //---------------------- Standardfunktionen ------------------------
186
187 friend INLINE intvector::intvector(const intmatrix_subv &) noexcept;
189 INLINE intmatrix_subv &operator =(const intmatrix_subv &rv) noexcept;
191 INLINE intmatrix_subv &operator =(const int &r) noexcept;
193 INLINE intmatrix_subv &operator =(const intmatrix &m)
194#if(CXSC_INDEX_CHECK)
195;
196#else
197 noexcept;
198#endif
201#if(CXSC_INDEX_CHECK)
202;
203#else
204 noexcept;
205#endif
207 INLINE intmatrix_subv &operator =(const intvector &v)
208#if(CXSC_INDEX_CHECK)
209;
210#else
211 noexcept;
212#endif
215#if(CXSC_INDEX_CHECK)
216;
217#else
218 noexcept;
219#endif
221 friend INLINE int Lb(const intmatrix_subv &rv) noexcept { return rv.lb; }
223 friend INLINE int Ub(const intmatrix_subv &rv) noexcept { return rv.ub; }
225 INLINE int &operator [](const int &i) const
226#if(CXSC_INDEX_CHECK)
227;
228#else
229 noexcept;
230#endif
232 INLINE intmatrix_subv &operator ()() noexcept { return *this; }
234 INLINE intmatrix_subv operator ()(const int &i)
235#if(CXSC_INDEX_CHECK)
236;
237#else
238 noexcept;
239#endif
241 INLINE intmatrix_subv operator ()(const int &i1,const int &i2)
242#if(CXSC_INDEX_CHECK)
243;
244#else
245 noexcept;
246#endif
247
249 INLINE intmatrix_subv &operator *=(const int &c) noexcept;
251 INLINE intmatrix_subv &operator +=(const int &c) noexcept;
253 INLINE intmatrix_subv &operator -=(const int &c) noexcept;
255 INLINE intmatrix_subv &operator /=(const int &c) noexcept;
257 INLINE intmatrix_subv &operator -=(const intvector &rv)
258#if(CXSC_INDEX_CHECK)
259;
260#else
261 noexcept;
262#endif
265#if(CXSC_INDEX_CHECK)
266;
267#else
268 noexcept;
269#endif
271 INLINE intmatrix_subv &operator +=(const intvector &rv)
272#if(CXSC_INDEX_CHECK)
273;
274#else
275 noexcept;
276#endif
279#if(CXSC_INDEX_CHECK)
280;
281#else
282 noexcept;
283#endif
284//#else
285//#endif
286
287};
288
289
291INLINE intmatrix_subv Row(intmatrix &m,const int &i)
292#if(CXSC_INDEX_CHECK)
293;
294#else
295 noexcept;
296#endif
298INLINE intmatrix_subv Col(intmatrix &m,const int &i)
299#if(CXSC_INDEX_CHECK)
300;
301#else
302 noexcept;
303#endif
304
305
306//----------------------- Matrix -----------------------------------------------
307
308class intmatrix_slice;
310
314{
315 friend class intmatrix_slice;
316 friend class intmatrix_subv;
317 private:
318 int *dat;
319 int lb1,ub1,lb2,ub2,xsize,ysize;
320
321 public:
322//#if(CXSC_INDEX_CHECK)
323#ifdef _CXSC_FRIEND_TPL
324 //----------------- Templates ---------------------------------------
325template <class S,class M> friend void _smconstr(S &s,const M &m)
326#if(CXSC_INDEX_CHECK)
327;
328#else
329 noexcept;
330#endif
331template <class V,class M,class S> friend void _vmconstr(V &v,const M &m)
332#if(CXSC_INDEX_CHECK)
333;
334#else
335 noexcept;
336#endif
337 template <class M1,class M2,class S> friend M1 &_mmassign(M1 &m1,const M2 &m,S ms) noexcept;
338 template <class M,class MS2,class S> friend M &_mmsassign(M &m,const MS2 &ms) noexcept;
339 template <class MS,class M> friend MS &_msmassign(MS &ms,const M &m)
340#if(CXSC_INDEX_CHECK)
341 ;
342#else
343 noexcept;
344#endif
345 template <class M,class S> friend M &_msassign(M &m,const S &r) noexcept;
346template <class V,class M,class S> friend V &_vmassign(V &v,const M &m)
347#if(CXSC_INDEX_CHECK)
348;
349#else
350 noexcept;
351#endif
352template <class M,class V,class S> friend M &_mvassign(M &m,const V &v) noexcept;
353 template <class M> friend int _mlb(const M &m, const int &i)
354#if(CXSC_INDEX_CHECK)
355;
356#else
357 noexcept;
358#endif
359 template <class M> friend int _mub(const M &m, const int &i)
360#if(CXSC_INDEX_CHECK)
361;
362#else
363 noexcept;
364#endif
365 template <class M> friend M &_msetlb(M &m, const int &i,const int &j)
366#if(CXSC_INDEX_CHECK)
367;
368#else
369 noexcept;
370#endif
371 template <class M> friend M &_msetub(M &m, const int &i,const int &j)
372#if(CXSC_INDEX_CHECK)
373;
374#else
375 noexcept;
376#endif
377 template <class M> friend void _mresize(M &A) noexcept;
378 template <class M,class S> friend void _mresize(M &A,const int &m, const int &n)
379#if(CXSC_INDEX_CHECK)
380 ;
381#else
382 noexcept;
383#endif
384 template <class M,class S> friend void _mresize(M &A,const int &m1, const int &m2,const int &n1,const int &n2)
385#if(CXSC_INDEX_CHECK)
386 ;
387#else
388 noexcept;
389#endif
390 template <class M,class E> friend E _mabs(const M &m) noexcept;
391 template <class MS,class E> friend E _msabs(const MS &ms) noexcept;
392 //------- matrix-matrix --------------
393 template <class M1,class M2,class E> friend E _mmplus(const M1 &m1,const M2 &m2)
394#if(CXSC_INDEX_CHECK)
395 ;
396#else
397 noexcept;
398#endif
399 template <class M,class MS,class E> friend E _mmsplus(const M &m,const MS &ms)
400#if(CXSC_INDEX_CHECK)
401 ;
402#else
403 noexcept;
404#endif
405 template <class MS1,class MS2,class E> friend E _msmsplus(const MS1 &m1,const MS2 &m2)
406#if(CXSC_INDEX_CHECK)
407 ;
408#else
409 noexcept;
410#endif
411 template <class M> friend M _mminus(const M &m) noexcept;
412 template <class MS,class E> friend E _msminus(const MS &ms) noexcept;
413 template <class M1,class M2,class E> friend E _mmminus(const M1 &m1,const M2 &m2)
414#if(CXSC_INDEX_CHECK)
415 ;
416#else
417 noexcept;
418#endif
419 template <class M1,class M2> friend M1 &_mmplusassign(M1 &m1,const M2 &m2)
420#if(CXSC_INDEX_CHECK)
421 ;
422#else
423 noexcept;
424#endif
425 template <class M,class MS> friend M &_mmsplusassign(M &m1,const MS &ms)
426#if(CXSC_INDEX_CHECK)
427 ;
428#else
429 noexcept;
430#endif
431 template <class MS,class M> friend MS &_msmplusassign(MS &ms,const M &m1)
432#if(CXSC_INDEX_CHECK)
433 ;
434#else
435 noexcept;
436#endif
437 template <class M,class MS,class E> friend E _mmsminus(const M &m,const MS &ms)
438#if(CXSC_INDEX_CHECK)
439 ;
440#else
441 noexcept;
442#endif
443 template <class MS,class M,class E> friend E _msmminus(const MS &ms,const M &m)
444#if(CXSC_INDEX_CHECK)
445 ;
446#else
447 noexcept;
448#endif
449 template <class MS1,class MS2,class E> friend E _msmsminus(const MS1 &ms1,const MS2 &ms2)
450#if(CXSC_INDEX_CHECK)
451 ;
452#else
453 noexcept;
454#endif
455 template <class M1,class M2> friend M1 &_mmminusassign(M1 &m1,const M2 &m2)
456#if(CXSC_INDEX_CHECK)
457 ;
458#else
459 noexcept;
460#endif
461 template <class M,class MS> friend M &_mmsminusassign(M &m1,const MS &ms)
462#if(CXSC_INDEX_CHECK)
463 ;
464#else
465 noexcept;
466#endif
467 template <class MS,class M> friend MS &_msmminusassign(MS &ms,const M &m1)
468#if(CXSC_INDEX_CHECK)
469 ;
470#else
471 noexcept;
472#endif
473 //-------- matrix-scalar ---------------------
474 template <class S,class M,class E> friend E _smmult(const S &c, const M &m) noexcept;
475 template <class M,class S> friend M &_msmultassign(M &m,const S &c) noexcept;
476 template <class S,class MS,class E> friend E _smsmult(const S &c, const MS &ms) noexcept;
477 template <class M,class S,class E> friend E _msdiv(const M &m,const S &c) noexcept;
478 template <class M,class S> friend M &_msdivassign(M &m,const S &c) noexcept;
479 template <class MS,class S,class E> friend E _mssdiv(const MS &ms, const S &c) noexcept;
480 //--------- matrix-vector --------------------
481
482 template <class M> friend void *_mvoid(const M &m) noexcept;
483 template <class M> friend bool _mnot(const M &m) noexcept;
484 template <class MS> friend void *_msvoid(const MS &ms) noexcept;
485 template <class MS> friend bool _msnot(const MS &ms) noexcept;
486 template <class M1,class M2> friend bool _mmeq(const M1 &m1,const M2 &m2) noexcept;
487 template <class M1,class M2> friend bool _mmneq(const M1 &m1,const M2 &m2) noexcept;
488 template <class M1,class M2> friend bool _mmless(const M1 &m1,const M2 &m2) noexcept;
489 template <class M1,class M2> friend bool _mmleq(const M1 &m1,const M2 &m2) noexcept;
490 template <class M,class MS> friend bool _mmseq(const M &m1,const MS &ms) noexcept;
491 template <class M,class MS> friend bool _mmsneq(const M &m1,const MS &ms) noexcept;
492 template <class M,class MS> friend bool _mmsless(const M &m1,const MS &ms) noexcept;
493 template <class M,class MS> friend bool _mmsleq(const M &m1,const MS &ms) noexcept;
494 template <class MS,class M> friend bool _msmless(const MS &ms,const M &m1) noexcept;
495 template <class MS,class M> friend bool _msmleq(const MS &ms,const M &m1) noexcept;
496 template <class M> friend std::ostream &_mout(std::ostream &s,const M &r) noexcept;
497 template <class M> friend std::istream &_min(std::istream &s,M &r) noexcept;
498
499#endif
500
501 //-------------------------- Konstruktoren ----------------------------
502
504 INLINE intmatrix(const intmatrix &rm) noexcept;
506 INLINE intmatrix(const intmatrix_slice &rm) noexcept;
508 INLINE intmatrix() noexcept;
510 explicit INLINE intmatrix(const int &m, const int &n)
511#if(CXSC_INDEX_CHECK)
512;
513#else
514 noexcept;
515#endif
517 explicit INLINE intmatrix(const int &m1, const int &n1, const int &m2, const int &n2)
518#if(CXSC_INDEX_CHECK)
519;
520#else
521 noexcept;
522#endif
524 explicit INLINE intmatrix(const intvector &v) noexcept;
526 explicit INLINE intmatrix(const intvector_slice &v) noexcept;
528 explicit INLINE intmatrix(const int &r) noexcept;
530 INLINE intmatrix &operator =(const int &r) noexcept;
532 INLINE intmatrix &operator =(const intmatrix &m) noexcept;
534 INLINE intmatrix &operator =(const intmatrix_slice &ms) noexcept;
536 INLINE intmatrix &operator =(const intvector &v) noexcept;
538 INLINE intmatrix &operator =(const intvector_slice &v) noexcept;
539
540 //--------------------------- Destruktoren -----------------------------
541
542 INLINE ~intmatrix() noexcept { delete [] dat; }
543
544 //------------------------- Standardfunktionen -------------------------
545
546 friend INLINE intvector::intvector(const intmatrix &m)
547#if(CXSC_INDEX_CHECK)
548;
549#else
550 noexcept;
551#endif
553 INLINE intmatrix_subv operator [](const int &i) const
554#if(CXSC_INDEX_CHECK)
555;
556#else
557 noexcept;
558#endif
560 INLINE intmatrix_subv operator [](const cxscmatrix_column &i) const
561#if(CXSC_INDEX_CHECK)
562;
563#else
564 noexcept;
565#endif
567 INLINE intmatrix &operator ()() noexcept { return *this; }
569 INLINE intmatrix_slice operator ()(const int &m, const int &n)
570#if(CXSC_INDEX_CHECK)
571;
572#else
573 noexcept;
574#endif
576 INLINE intmatrix_slice operator ()(const int &m1, const int &m2, const int &n1, const int &n2)
577#if(CXSC_INDEX_CHECK)
578;
579#else
580 noexcept;
581#endif
582 INLINE operator void*() noexcept;
583//#else
584//#endif
585};
586
588
594{
595 friend class intmatrix;
596 private:
597 int *dat;
598 int offset1,offset2,mxsize,mysize;
599 int start1,end1,start2,end2,sxsize,sysize; // slice size
600
601 public:
602//#if(CXSC_INDEX_CHECK)
603#ifdef _CXSC_FRIEND_TPL
604 //----------------- Templates ---------------------------------------
605template <class V,class MS,class S> friend void _vmsconstr(V &v,const MS &m)
606#if(CXSC_INDEX_CHECK)
607;
608#else
609 noexcept;
610#endif
611 template <class MS,class M> friend MS &_msmassign(MS &ms,const M &m)
612#if(CXSC_INDEX_CHECK)
613 ;
614#else
615 noexcept;
616#endif
617 template <class MS1,class MS2> friend MS1 &_msmsassign(MS1 &ms1,const MS2 &ms)
618#if(CXSC_INDEX_CHECK)
619 ;
620#else
621 noexcept;
622#endif
623 template <class M,class MS2,class S> friend M &_mmsassign(M &m,const MS2 &ms) noexcept;
624 template <class MS,class S> friend MS &_mssassign(MS &ms,const S &r) noexcept;
625 template <class MS> friend int _mslb(const MS &ms, const int &i)
626#if(CXSC_INDEX_CHECK)
627;
628#else
629 noexcept;
630#endif
631 template <class MS> friend int _msub(const MS &ms, const int &i)
632#if(CXSC_INDEX_CHECK)
633;
634#else
635 noexcept;
636#endif
637 template <class MS,class E> friend E _msabs(const MS &ms) noexcept;
638 //------------ matrix-matrix --------------------
639 template <class MS,class E> friend E _msminus(const MS &ms) noexcept;
640 template <class M,class MS,class E> friend E _mmsplus(const M &m,const MS &ms)
641#if(CXSC_INDEX_CHECK)
642 ;
643#else
644 noexcept;
645#endif
646 template <class MS1,class MS2,class E> friend E _msmsplus(const MS1 &m1,const MS2 &m2)
647#if(CXSC_INDEX_CHECK)
648 ;
649#else
650 noexcept;
651#endif
652 template <class M,class MS> friend M &_mmsplusassign(M &m1,const MS &ms)
653#if(CXSC_INDEX_CHECK)
654 ;
655#else
656 noexcept;
657#endif
658 template <class MS,class M> friend MS &_msmplusassign(MS &ms,const M &m1)
659#if(CXSC_INDEX_CHECK)
660 ;
661#else
662 noexcept;
663#endif
664 template <class MS1,class MS2> friend MS1 &_msmsplusassign(MS1 &ms1,const MS2 &ms2)
665#if(CXSC_INDEX_CHECK)
666 ;
667#else
668 noexcept;
669#endif
670 template <class M,class MS,class E> friend E _mmsminus(const M &m,const MS &ms)
671#if(CXSC_INDEX_CHECK)
672 ;
673#else
674 noexcept;
675#endif
676 template <class MS,class M,class E> friend E _msmminus(const MS &ms,const M &m)
677#if(CXSC_INDEX_CHECK)
678 ;
679#else
680 noexcept;
681#endif
682 template <class MS1,class MS2,class E> friend E _msmsminus(const MS1 &ms1,const MS2 &ms2)
683#if(CXSC_INDEX_CHECK)
684 ;
685#else
686 noexcept;
687#endif
688 template <class M,class MS> friend M &_mmsminusassign(M &m1,const MS &ms)
689#if(CXSC_INDEX_CHECK)
690 ;
691#else
692 noexcept;
693#endif
694 template <class MS,class M> friend MS &_msmminusassign(MS &ms,const M &m1)
695#if(CXSC_INDEX_CHECK)
696 ;
697#else
698 noexcept;
699#endif
700 template <class MS1,class MS2> friend MS1 &_msmsminusassign(MS1 &ms1,const MS2 &ms2)
701#if(CXSC_INDEX_CHECK)
702 ;
703#else
704 noexcept;
705#endif
706 //--------- matrix-scalar -----------------
707 template <class S,class MS,class E> friend E _smsmult(const S &c, const MS &ms) noexcept;
708 template <class MS,class S> friend MS &_mssmultassign(MS &ms,const S &c) noexcept;
709 template <class MS,class S,class E> friend E _mssdiv(const MS &ms, const S &c) noexcept;
710 template <class MS,class S> friend MS &_mssdivassign(MS &ms,const S &c) noexcept;
711
712 template <class MS> friend void *_msvoid(const MS &ms) noexcept;
713 template <class MS> friend bool _msnot(const MS &ms) noexcept;
714 template <class M,class MS> friend bool _mmseq(const M &m1,const MS &ms) noexcept;
715 template <class M,class MS> friend bool _mmsneq(const M &m1,const MS &ms) noexcept;
716 template <class M,class MS> friend bool _mmsless(const M &m1,const MS &ms) noexcept;
717 template <class M,class MS> friend bool _mmsleq(const M &m1,const MS &ms) noexcept;
718 template <class MS,class M> friend bool _msmless(const MS &ms,const M &m1) noexcept;
719 template <class MS,class M> friend bool _msmleq(const MS &ms,const M &m1) noexcept;
720 template <class MS1,class MS2> friend bool _msmseq(const MS1 &ms1,const MS2 &ms2) noexcept;
721 template <class MS1,class MS2> friend bool _msmsneq(const MS1 &ms1,const MS2 &ms2) noexcept;
722 template <class MS1,class MS2> friend bool _msmsless(const MS1 &ms1,const MS2 &ms2) noexcept;
723 template <class MS1,class MS2> friend bool _msmsleq(const MS1 &ms1,const MS2 &ms2) noexcept;
724 template <class MS> friend std::ostream &_msout(std::ostream &s,const MS &r) noexcept;
725 template <class MS> friend std::istream &_msin(std::istream &s,MS &r) noexcept;
726
727#endif
728
729
730 //--------------- Konstruktoren ----------------------------------------
731
733 explicit INLINE intmatrix_slice(intmatrix &a,const int &l1,const int &u1,const int &l2, const int &u2) noexcept:dat(a.dat),offset1(l1-a.lb1),offset2(l2-a.lb2),mxsize(a.xsize),mysize(a.ysize),start1(l1),end1(u1),start2(l2),end2(u2),sxsize(u2-l2+1),sysize(u1-l1+1) { }
735 explicit INLINE intmatrix_slice(intmatrix_slice &a,const int &l1,const int &u1,const int &l2, const int &u2) noexcept:dat(a.dat),offset1(a.offset1+l1-a.start1),offset2(a.offset2+l2-a.start2),mxsize(a.mxsize),mysize(a.mysize),start1(l1),end1(u1),start2(l2),end2(u2),sxsize(u2-l2+1),sysize(u1-l1+1) { }
736 public:
738 INLINE intmatrix_slice(const intmatrix_slice &ms) noexcept:dat(ms.dat),offset1(ms.offset1),offset2(ms.offset2),mxsize(ms.mxsize),mysize(ms.mysize),start1(ms.start1),end1(ms.end1),start2(ms.start2),end2(ms.end2),sxsize(ms.sxsize),sysize(ms.sysize) { }
739 public:
740
741 //---------------- Standardfunktionen -----------------------------------
742
743 friend intvector::intvector(const intmatrix_slice &sl)
744#if(CXSC_INDEX_CHECK)
745;
746#else
747 noexcept;
748#endif
749 friend INLINE intmatrix::intmatrix(const intmatrix_slice &) noexcept;
751 INLINE intmatrix_slice &operator =(const intmatrix &m)
752#if(CXSC_INDEX_CHECK)
753;
754#else
755 noexcept;
756#endif
759#if(CXSC_INDEX_CHECK)
760;
761#else
762 noexcept;
763#endif
765 INLINE intmatrix_slice &operator =(const int &r) noexcept;
767 INLINE intmatrix_slice &operator =(const intvector &v)
768#if(CXSC_INDEX_CHECK)
769;
770#else
771 noexcept;
772#endif
775#if(CXSC_INDEX_CHECK)
776;
777#else
778 noexcept;
779#endif
782#if(CXSC_INDEX_CHECK)
783;
784#else
785 noexcept;
786#endif
788 INLINE intmatrix_subv operator [](const int &i)
789#if(CXSC_INDEX_CHECK)
790;
791#else
792 noexcept;
793#endif
795 INLINE intmatrix_subv operator [](const cxscmatrix_column &i)
796#if(CXSC_INDEX_CHECK)
797;
798#else
799 noexcept;
800#endif
802 INLINE intmatrix_slice &operator ()() noexcept { return *this; }
804 INLINE intmatrix_slice operator ()(const int &m, const int &n)
805#if(CXSC_INDEX_CHECK)
806;
807#else
808 noexcept;
809#endif
811 INLINE intmatrix_slice operator ()(const int &m1, const int &m2, const int &n1, const int &n2)
812#if(CXSC_INDEX_CHECK)
813;
814#else
815 noexcept;
816#endif
818 INLINE intmatrix_slice& operator +=(const intmatrix &m1)
819#if(CXSC_INDEX_CHECK)
820;
821#else
822 noexcept;
823#endif
826#if(CXSC_INDEX_CHECK)
827;
828#else
829 noexcept;
830#endif
832 INLINE intmatrix_slice& operator -=(const intmatrix &m1)
833#if(CXSC_INDEX_CHECK)
834;
835#else
836 noexcept;
837#endif
840#if(CXSC_INDEX_CHECK)
841;
842#else
843 noexcept;
844#endif
846 INLINE intmatrix_slice& operator *=(const int &c) noexcept;
848 INLINE intmatrix_slice& operator /=(const int &c) noexcept;
849 INLINE operator void*() noexcept;
850//#else
851//#endif
852};
853
854//================================================================
855//====================== Subvector Functions =====================
856
857//=======================Vector / Scalar =========================
858
860 INLINE intvector operator /(const intmatrix_subv &rv, const int &s) noexcept;
862 INLINE intvector operator *(const intmatrix_subv &rv, const int &s) noexcept;
864 INLINE intvector operator *(const int &s, const intmatrix_subv &rv) noexcept;
866 INLINE intvector abs(const intmatrix_subv &mv) noexcept;
867
868//======================== Vector / Vector ========================
869
871 INLINE void accumulate(dotprecision &dp, const intmatrix_subv & rv1, const intmatrix_subv &rv2)
872#if(CXSC_INDEX_CHECK)
873;
874#else
875 noexcept;
876#endif
878 INLINE void accumulate(dotprecision &dp, const intvector & rv1, const intmatrix_subv &rv2)
879#if(CXSC_INDEX_CHECK)
880;
881#else
882 noexcept;
883#endif
885 INLINE void accumulate(dotprecision &dp, const intmatrix_subv & rv1, const intvector &rv2)
886#if(CXSC_INDEX_CHECK)
887;
888#else
889 noexcept;
890#endif
892 INLINE void accumulate(dotprecision &dp,const intvector_slice &sl,const intmatrix_subv &sv)
893#if(CXSC_INDEX_CHECK)
894;
895#else
896 noexcept;
897#endif
899 INLINE void accumulate(dotprecision &dp,const intmatrix_subv &mv,const intvector_slice &vs)
900#if(CXSC_INDEX_CHECK)
901;
902#else
903 noexcept;
904#endif
905
907 INLINE intvector operator +(const intmatrix_subv & rv1, const intmatrix_subv &rv2)
908#if(CXSC_INDEX_CHECK)
909;
910#else
911 noexcept;
912#endif
914 INLINE intvector operator +(const intmatrix_subv &rv1,const intvector &rv2)
915#if(CXSC_INDEX_CHECK)
916;
917#else
918 noexcept;
919#endif
921 INLINE intvector operator +(const intvector & rv1, const intmatrix_subv &rv2)
922#if(CXSC_INDEX_CHECK)
923;
924#else
925 noexcept;
926#endif
928 INLINE intvector operator +(const intvector_slice &sl,const intmatrix_subv &mv)
929#if(CXSC_INDEX_CHECK)
930;
931#else
932 noexcept;
933#endif
935 INLINE intvector operator +(const intmatrix_subv &mv,const intvector_slice &sl)
936#if(CXSC_INDEX_CHECK)
937;
938#else
939 noexcept;
940#endif
941
943 INLINE intvector operator -(const intmatrix_subv & rv1, const intmatrix_subv &rv2)
944#if(CXSC_INDEX_CHECK)
945;
946#else
947 noexcept;
948#endif
950 INLINE intvector operator -(const intvector & rv1, const intmatrix_subv &rv2)
951#if(CXSC_INDEX_CHECK)
952;
953#else
954 noexcept;
955#endif
957 INLINE intvector operator -(const intmatrix_subv &rv1,const intvector &rv2)
958#if(CXSC_INDEX_CHECK)
959;
960#else
961 noexcept;
962#endif
964 INLINE intvector operator -(const intvector_slice &sl,const intmatrix_subv &mv)
965#if(CXSC_INDEX_CHECK)
966;
967#else
968 noexcept;
969#endif
971 INLINE intvector operator -(const intmatrix_subv &mv,const intvector_slice &sl)
972#if(CXSC_INDEX_CHECK)
973;
974#else
975 noexcept;
976#endif
977
978//====================================================================
979//===================== Matrix Functions =============================
980
982 INLINE intmatrix _intmatrix(const intmatrix &rm) noexcept;
984 INLINE intmatrix _intmatrix(const intvector &v) noexcept;
986 INLINE intmatrix _intmatrix(const intvector_slice &v) noexcept;
988 INLINE intmatrix _intmatrix(const int &r) noexcept;
989
991 INLINE int Lb(const intmatrix &rm, const int &i)
992#if(CXSC_INDEX_CHECK)
993;
994#else
995 noexcept;
996#endif
998 INLINE int Ub(const intmatrix &rm, const int &i)
999#if(CXSC_INDEX_CHECK)
1000;
1001#else
1002 noexcept;
1003#endif
1005 INLINE int Lb(const intmatrix_slice &rm, const int &i)
1006#if(CXSC_INDEX_CHECK)
1007;
1008#else
1009 noexcept;
1010#endif
1012 INLINE int Ub(const intmatrix_slice &rm, const int &i)
1013#if(CXSC_INDEX_CHECK)
1014;
1015#else
1016 noexcept;
1017#endif
1019 INLINE intmatrix &SetLb(intmatrix &m, const int &i,const int &j)
1020#if(CXSC_INDEX_CHECK)
1021;
1022#else
1023 noexcept;
1024#endif
1026 INLINE intmatrix &SetUb(intmatrix &m, const int &i,const int &j)
1027#if(CXSC_INDEX_CHECK)
1028;
1029#else
1030 noexcept;
1031#endif
1033 INLINE void Resize(intmatrix &A) noexcept;
1035 INLINE void Resize(intmatrix &A,const int &m, const int &n)
1036#if(CXSC_INDEX_CHECK)
1037;
1038#else
1039 noexcept;
1040#endif
1042 INLINE void Resize(intmatrix &A,const int &m1, const int &m2,const int &n1,const int &n2)
1043#if(CXSC_INDEX_CHECK)
1044;
1045#else
1046 noexcept;
1047#endif
1048
1050 INLINE intmatrix abs(const intmatrix &m) noexcept;
1052 INLINE intmatrix abs(const intmatrix_slice &ms) noexcept;
1053
1054//===================== Matrix / Scalar ===============================
1055
1057 INLINE intmatrix operator *(const int &c, const intmatrix &m) noexcept;
1059 INLINE intmatrix operator *(const int &c, const intmatrix_slice &ms) noexcept;
1061 INLINE intmatrix operator *(const intmatrix &m,const int &c) noexcept;
1063 INLINE intmatrix operator *(const intmatrix_slice &ms,const int &c) noexcept;
1065 INLINE intmatrix &operator *=(intmatrix &m,const int &c) noexcept;
1067 INLINE intmatrix operator /(const intmatrix &m,const int &c) noexcept;
1069 INLINE intmatrix operator /(const intmatrix_slice &ms, const int &c) noexcept;
1071 INLINE intmatrix &operator /=(intmatrix &m,const int &c) noexcept;
1072
1073
1074//================ Matrix / Matrix ============================
1075
1077 INLINE const intmatrix &operator +(const intmatrix &m1) noexcept;
1079 INLINE intmatrix operator +(const intmatrix_slice &ms) noexcept;
1081 INLINE intmatrix operator +(const intmatrix &m1,const intmatrix &m2)
1082#if(CXSC_INDEX_CHECK)
1083;
1084#else
1085 noexcept;
1086#endif
1088 INLINE intmatrix operator +(const intmatrix &m,const intmatrix_slice &ms)
1089#if(CXSC_INDEX_CHECK)
1090;
1091#else
1092 noexcept;
1093#endif
1095 INLINE intmatrix operator +(const intmatrix_slice &ms,const intmatrix &m)
1096#if(CXSC_INDEX_CHECK)
1097;
1098#else
1099 noexcept;
1100#endif
1102 INLINE intmatrix operator +(const intmatrix_slice &m1,const intmatrix_slice &m2)
1103#if(CXSC_INDEX_CHECK)
1104;
1105#else
1106 noexcept;
1107#endif
1109 INLINE intmatrix &operator +=(intmatrix &m1,const intmatrix &m2)
1110#if(CXSC_INDEX_CHECK)
1111;
1112#else
1113 noexcept;
1114#endif
1116 INLINE intmatrix &operator +=(intmatrix &m1,const intmatrix_slice &ms)
1117#if(CXSC_INDEX_CHECK)
1118;
1119#else
1120 noexcept;
1121#endif
1122
1124 INLINE intmatrix operator -(const intmatrix &m) noexcept;
1126 INLINE intmatrix operator -(const intmatrix_slice &ms) noexcept;
1128 INLINE intmatrix operator -(const intmatrix &m1,const intmatrix &m2)
1129#if(CXSC_INDEX_CHECK)
1130;
1131#else
1132 noexcept;
1133#endif
1135 INLINE intmatrix operator -(const intmatrix &m,const intmatrix_slice &ms)
1136#if(CXSC_INDEX_CHECK)
1137;
1138#else
1139 noexcept;
1140#endif
1142 INLINE intmatrix operator -(const intmatrix_slice &ms,const intmatrix &m)
1143#if(CXSC_INDEX_CHECK)
1144;
1145#else
1146 noexcept;
1147#endif
1149 INLINE intmatrix operator -(const intmatrix_slice &ms1,const intmatrix_slice &ms2)
1150#if(CXSC_INDEX_CHECK)
1151;
1152#else
1153 noexcept;
1154#endif
1156 INLINE intmatrix &operator -=(intmatrix &m1,const intmatrix &m2)
1157#if(CXSC_INDEX_CHECK)
1158;
1159#else
1160 noexcept;
1161#endif
1163 INLINE intmatrix &operator -=(intmatrix &m1,const intmatrix_slice &ms)
1164#if(CXSC_INDEX_CHECK)
1165;
1166#else
1167 noexcept;
1168#endif
1169
1170
1171//============== Compare Operator ==========================
1172
1173//-------------- Matrix - Matrix -------------------------
1174
1176 INLINE bool operator ==(const intmatrix &m1,const intmatrix &m2) noexcept;
1178 INLINE bool operator !=(const intmatrix &m1,const intmatrix &m2) noexcept;
1180 INLINE bool operator <(const intmatrix &m1,const intmatrix &m2) noexcept;
1182 INLINE bool operator <=(const intmatrix &m1,const intmatrix &m2) noexcept;
1184 INLINE bool operator >(const intmatrix &m1,const intmatrix &m2) noexcept;
1186 INLINE bool operator >=(const intmatrix &m1,const intmatrix &m2) noexcept;
1188 INLINE bool operator ==(const intmatrix &m1,const intmatrix_slice &ms) noexcept;
1190 INLINE bool operator !=(const intmatrix &m1,const intmatrix_slice &ms) noexcept;
1192 INLINE bool operator <(const intmatrix &m1,const intmatrix_slice &ms) noexcept;
1194 INLINE bool operator <=(const intmatrix &m1,const intmatrix_slice &ms) noexcept;
1196 INLINE bool operator >(const intmatrix &m1,const intmatrix_slice &ms) noexcept;
1198 INLINE bool operator >=(const intmatrix &m1,const intmatrix_slice &ms) noexcept;
1199
1200//---------------- Matrix - Matrix_slice ----------------------
1201
1203 INLINE bool operator ==(const intmatrix_slice &m1,const intmatrix_slice &m2) noexcept;
1205 INLINE bool operator !=(const intmatrix_slice &m1,const intmatrix_slice &m2) noexcept;
1207 INLINE bool operator <(const intmatrix_slice &m1,const intmatrix_slice &m2) noexcept;
1209 INLINE bool operator <=(const intmatrix_slice &m1,const intmatrix_slice &m2) noexcept;
1211 INLINE bool operator >(const intmatrix_slice &m1,const intmatrix_slice &m2) noexcept;
1213 INLINE bool operator >=(const intmatrix_slice &m1,const intmatrix_slice &m2) noexcept;
1214
1215//=================== Not Operator =============================
1216
1218 INLINE bool operator !(const intmatrix &ms) noexcept;
1220 INLINE bool operator !(const intmatrix_slice &ms) noexcept;
1221
1222//======================== Input / Output ========================
1223
1225 INLINE std::ostream &operator <<(std::ostream &s,const intmatrix &r) noexcept;
1227 INLINE std::ostream &operator <<(std::ostream &s,const intmatrix_slice &r) noexcept;
1229 INLINE std::istream &operator >>(std::istream &s,intmatrix &r) noexcept;
1231 INLINE std::istream &operator >>(std::istream &s,intmatrix_slice &r) noexcept;
1232
1234 INLINE int RowLen ( const intmatrix& );
1236 INLINE int ColLen ( const intmatrix& );
1239 INLINE int RowLen ( const intmatrix_slice& );
1241 INLINE int ColLen ( const intmatrix_slice& );
1243 intmatrix Id ( const intmatrix& );
1245 intmatrix transp ( const intmatrix& );
1247 void DoubleSize ( intmatrix& );
1248
1249//=================== Permutation matrix/vector functions =======================
1250
1251 INLINE intvector permvec(const intmatrix&);
1252 INLINE intmatrix permmat(const intvector&);
1253 INLINE intmatrix perminv(const intmatrix&);
1254
1255} // namespace cxsc
1256
1257#ifdef _CXSC_INCL_INL
1258# include "matrix.inl"
1259# include "intmatrix.inl"
1260#endif
1261
1262#endif
1263
The Data Type intmatrix_slice.
intmatrix_slice & operator-=(const intmatrix &m1) noexcept
Implementation of subtraction and allocation operation.
intmatrix_slice & operator=(const intmatrix &m) noexcept
Implementation of standard assigning operator.
intmatrix_slice & operator*=(const int &c) noexcept
Implementation of multiplication and allocation operation.
intmatrix_slice & operator+=(const intmatrix &m1) noexcept
Implementation of addition and allocation operation.
intmatrix_slice(intmatrix &a, const int &l1, const int &u1, const int &l2, const int &u2) noexcept
Constructor of class intmatrix_slice.
intmatrix_slice(const intmatrix_slice &ms) noexcept
Constructor of class intmatrix_slice.
intmatrix_slice & operator/=(const int &c) noexcept
Implementation of division and allocation operation.
intmatrix_slice & operator()() noexcept
Operator for accessing the whole matrix.
intmatrix_slice(intmatrix_slice &a, const int &l1, const int &u1, const int &l2, const int &u2) noexcept
Constructor of class intmatrix_slice.
intmatrix_subv operator[](const int &i) noexcept
Operator for accessing a single row of the matrix.
The Data Type intmatrix_subv.
Definition intmatrix.hpp:46
friend int Ub(const intmatrix_subv &rv) noexcept
Returns the upper bound of the vector.
int & operator[](const int &i) const noexcept
Operator for accessing the single elements of the vector.
Definition intmatrix.inl:95
intmatrix_subv & operator/=(const int &c) noexcept
Implementation of division and allocation operation.
intmatrix_subv & operator=(const intmatrix_subv &rv) noexcept
Implementation of standard assigning operator.
intmatrix_subv(const intmatrix_subv &v) noexcept
Constructor of class intmatrix_subv.
intmatrix_subv(int *d, const int &l, const int &u, const int &s, const int &st, const int &o) noexcept
Constructor of class intmatrix_subv.
friend int Lb(const intmatrix_subv &rv) noexcept
Returns the lower bound of the vector.
intmatrix_subv & operator+=(const int &c) noexcept
Implementation of addition and allocation operation.
friend intmatrix_subv Col(intmatrix &m, const int &i) noexcept
Returns one column of the matrix as a vector.
intmatrix_subv & operator()() noexcept
Operator for accessing the whole vector.
friend intmatrix_subv Row(intmatrix &m, const int &i) noexcept
Returns one row of the matrix as a vector.
intmatrix_subv & operator-=(const int &c) noexcept
Implementation of subtraction and allocation operation.
intmatrix_subv & operator*=(const int &c) noexcept
Implementation of multiplication and allocation operation.
The Data Type intmatrix.
intmatrix & operator()() noexcept
Operator for accessing the whole matrix.
intmatrix & operator=(const int &r) noexcept
Implementation of standard assigning operator.
intmatrix() noexcept
Constructor of class intmatrix.
Definition intmatrix.inl:31
intmatrix_subv operator[](const int &i) const noexcept
Operator for accessing a single row of the matrix.
The Data Type intvector_slice.
The Data Type intvector.
Definition intvector.hpp:52
intvector() noexcept
Constructor of class intvector.
Definition intvector.inl:33
The namespace cxsc, providing all functionality of the class library C-XSC.
Definition cdot.cpp:29
cdotprecision & operator+=(cdotprecision &cd, const l_complex &lc) noexcept
Implementation of standard algebraic addition and allocation operation.
Definition cdot.inl:251
cimatrix_subv Col(cimatrix &m, const int &i) noexcept
Returns one column of the matrix as a vector.
Definition cimatrix.inl:242
int ColLen(const cimatrix &)
Returns the column dimension.
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
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.
intmatrix _intmatrix(const intmatrix &rm) noexcept
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
int RowLen(const cimatrix &)
Returns the row dimension.
cimatrix_subv Row(cimatrix &m, const int &i) noexcept
Returns one row of the matrix as a vector.
Definition cimatrix.inl:231
void DoubleSize(cimatrix &A)
Doubles the size of the matrix.
Definition cimatrix.cpp:83
cimatrix Id(const cimatrix &A)
Returns the Identity matrix.
Definition cimatrix.cpp:61
cimatrix & operator*=(cimatrix &m, const cinterval &c) noexcept
Implementation of multiplication and allocation operation.
ivector abs(const cimatrix_subv &mv) noexcept
Returns the absolute value of the matrix.
Definition cimatrix.inl:737
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.
cimatrix & operator/=(cimatrix &m, const cinterval &c) noexcept
Implementation of division and allocation operation.