C-XSC - A C++ Class Library for Extended Scientific Computing 2.5.4
cmatrix.inl
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: cmatrix.inl,v 1.28 2014/01/30 17:23:44 cxsc Exp $ */
25
26#ifndef _CXSC_CMATRIX_INL_INCLUDED
27#define _CXSC_CMATRIX_INL_INCLUDED
28
29namespace cxsc {
30
31INLINE cmatrix::cmatrix() noexcept:dat(NULL),lb1(1),ub1(0),lb2(1),ub2(0),xsize(0),ysize(0)
32{
33}
34
35INLINE cmatrix::cmatrix(const complex &r) noexcept:lb1(1),ub1(1),lb2(1),ub2(1),xsize(1),ysize(1)
36{
37 dat=new complex[1];
38 *dat=r;
39}
40
41INLINE cmatrix::cmatrix(const real &r) noexcept:lb1(1),ub1(1),lb2(1),ub2(1),xsize(1),ysize(1)
42{
43 dat=new complex[1];
44 *dat=r;
45}
46
47INLINE cmatrix::cmatrix(const cmatrix &rm) noexcept:lb1(rm.lb1),ub1(rm.ub1),lb2(rm.lb2),ub2(rm.ub2),xsize(rm.xsize),ysize(rm.ysize)
48{
49 dat=new complex[xsize*ysize];
50 for(int i=0;i<xsize*ysize;i++)
51 dat[i]=rm.dat[i];
52}
53
54INLINE cmatrix::cmatrix(const rmatrix &rm) noexcept:lb1(rm.lb1),ub1(rm.ub1),lb2(rm.lb2),ub2(rm.ub2),xsize(rm.xsize),ysize(rm.ysize)
55{
56 dat=new complex[xsize*ysize];
57 for(int i=0;i<xsize*ysize;i++)
58 dat[i]=rm.dat[i];
59}
60
61INLINE cmatrix::cmatrix(const int &m, const int &n)
62#if(CXSC_INDEX_CHECK)
63:lb1(1),ub1(m),lb2(1),ub2(n),xsize(n),ysize(m)
64#else
65 noexcept:lb1(1),ub1(m),lb2(1),ub2(n),xsize(n),ysize(m)
66#endif
67{
68#if(CXSC_INDEX_CHECK)
69 if((n<0)||(m<0)) cxscthrow(ERROR_CMATRIX_WRONG_BOUNDARIES("cmatrix::cmatrix(const int &m, const int &n)"));
70#endif
71 dat=new complex[m*n];
72}
73
74INLINE cmatrix::cmatrix(const int &m1, const int &m2, const int &n1, const int &n2)
75#if(CXSC_INDEX_CHECK)
76:lb1(m1),ub1(m2),lb2(n1),ub2(n2),xsize(n2-n1+1),ysize(m2-m1+1)
77#else
78 noexcept:lb1(m1),ub1(m2),lb2(n1),ub2(n2),xsize(n2-n1+1),ysize(m2-m1+1)
79#endif
80{
81#if(CXSC_INDEX_CHECK)
82 if((m2<m1)||(n2<n1)) cxscthrow(ERROR_CMATRIX_WRONG_BOUNDARIES("cmatrix::cmatrix(const int &m1, const int &n1, const int &m2, const int &n2)"));
83#endif
84 dat=new complex[xsize*ysize];
85}
86
87INLINE cvector::cvector(const cmatrix_subv &v) noexcept:l(v.lb),u(v.ub),size(v.size)
88{
89 dat=new complex[size];
90 for (int i=0, j=v.start;i<v.size;i++,j+=v.offset)
91 dat[i]=v.dat[j];
92}
93
94INLINE cmatrix::cmatrix(const cvector &v) noexcept:lb1(v.l),ub1(v.u),lb2(1),ub2(1),xsize(1),ysize(v.size)
95{
96 dat=new complex[v.size];
97 for(int i=0;i<v.size;i++)
98 dat[i]=v.dat[i];
99}
100
101INLINE cmatrix::cmatrix(const rvector &v) noexcept:lb1(v.l),ub1(v.u),lb2(1),ub2(1),xsize(1),ysize(v.size)
102{
103 dat=new complex[v.size];
104 for(int i=0;i<v.size;i++)
105 dat[i]=v.dat[i];
106}
107
108INLINE cmatrix::cmatrix(const cvector_slice &v) noexcept:lb1(v.start),ub1(v.end),lb2(1),ub2(1),xsize(1),ysize(v.size)
109{
110 dat=new complex[v.size];
111 for(int i=0,j=v.start-v.l;i<v.size;i++,j++)
112 dat[i]=v.dat[j];
113}
114
115INLINE cmatrix::cmatrix(const rvector_slice &v) noexcept:lb1(v.start),ub1(v.end),lb2(1),ub2(1),xsize(1),ysize(v.size)
116{
117 dat=new complex[v.size];
118 for(int i=0,j=v.start-v.l;i<v.size;i++,j++)
119 dat[i]=v.dat[j];
120}
121
122
123 INLINE cmatrix::cmatrix(const cmatrix_slice &sl) noexcept:lb1(sl.start1),ub1(sl.end1),lb2(sl.start2),ub2(sl.end2),xsize(sl.sxsize),ysize(sl.sysize)
124 {
125 int i,j;
126
127 dat=new complex[xsize*ysize];
128 for (i=0;i<ysize;i++)
129 {
130 for(j=0;j<xsize;j++)
131 {
132 dat[i*xsize+j]=sl.dat[(sl.offset1+i)*sl.mxsize+sl.offset2+j];
133 }
134 }
135 }
136
137 INLINE cmatrix::cmatrix(const rmatrix_slice &sl) noexcept:lb1(sl.start1),ub1(sl.end1),lb2(sl.start2),ub2(sl.end2),xsize(sl.sxsize),ysize(sl.sysize)
138 {
139 int i,j;
140
141 dat=new complex[xsize*ysize];
142 for (i=0;i<ysize;i++)
143 {
144 for(j=0;j<xsize;j++)
145 {
146 dat[i*xsize+j]=sl.dat[(sl.offset1+i)*sl.mxsize+sl.offset2+j];
147 }
148 }
149 }
150
151 INLINE cmatrix_subv Row(cmatrix &m,const int &i)
152#if(CXSC_INDEX_CHECK)
153
154#else
155 noexcept
156#endif
157
158 {
159 return m[i];
160 }
161
162 INLINE cmatrix_subv Col(cmatrix &m,const int &i)
163#if(CXSC_INDEX_CHECK)
164
165#else
166 noexcept
167#endif
168
169 {
170 return m[Col(i)];
171 }
172
173 INLINE cmatrix_subv Row(const cmatrix &m,const int &i)
174#if(CXSC_INDEX_CHECK)
175
176#else
177 noexcept
178#endif
179
180 {
181 return m[i];
182 }
183
184 INLINE cmatrix_subv Col(const cmatrix &m,const int &i)
185#if(CXSC_INDEX_CHECK)
186
187#else
188 noexcept
189#endif
190
191 {
192 return m[Col(i)];
193 }
194
195 INLINE complex& cmatrix_subv::operator [](const int &i) const
196#if(CXSC_INDEX_CHECK)
197
198#else
199 noexcept
200#endif
201 {
202#if(CXSC_INDEX_CHECK)
203 if((i<lb)||(i>ub)) cxscthrow(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC("complex &cmatrix_subv::operator [](const int &i) const"));
204#endif
205 return dat[start+((i-lb)*offset)];
206 }
207
208 INLINE complex& cmatrix_subv::operator [](const int &i)
209#if(CXSC_INDEX_CHECK)
210
211#else
212 noexcept
213#endif
214 {
215#if(CXSC_INDEX_CHECK)
216 if((i<lb)||(i>ub)) cxscthrow(ERROR_CVECTOR_ELEMENT_NOT_IN_VEC("complex &cmatrix_subv::operator [](const int &i)"));
217#endif
218 return dat[start+((i-lb)*offset)];
219 }
220
221
222 INLINE cmatrix_subv cmatrix::operator [](const int &i) const
223#if(CXSC_INDEX_CHECK)
224
225#else
226 noexcept
227#endif
228 {
229#if(CXSC_INDEX_CHECK)
230 if((i<lb1)||(i>ub1)) cxscthrow(ERROR_CMATRIX_ROW_OR_COL_NOT_IN_MAT("cmatrix_subv cmatrix::operator [](const int &i)"));
231#endif
232 return cmatrix_subv(dat, lb2, ub2, xsize, xsize*(i-lb1),1);
233 }
234
235 INLINE cmatrix_subv cmatrix::operator [](const cxscmatrix_column &i) const
236#if(CXSC_INDEX_CHECK)
237
238#else
239 noexcept
240#endif
241 {
242#if(CXSC_INDEX_CHECK)
243 if((i.col()<lb2)||(i.col()>ub2)) cxscthrow(ERROR_CMATRIX_ROW_OR_COL_NOT_IN_MAT("cmatrix_subv cmatrix::operator [](const cxscmatrix_column &i)"));
244#endif
245 return cmatrix_subv(dat, lb1, ub1, ysize, i.col()-lb2, xsize);
246 }
247
248 INLINE cmatrix_subv cmatrix::operator [](const int &i)
249#if(CXSC_INDEX_CHECK)
250
251#else
252 noexcept
253#endif
254 {
255#if(CXSC_INDEX_CHECK)
256 if((i<lb1)||(i>ub1)) cxscthrow(ERROR_CMATRIX_ROW_OR_COL_NOT_IN_MAT("cmatrix_subv cmatrix::operator [](const int &i)"));
257#endif
258 return cmatrix_subv(dat, lb2, ub2, xsize, xsize*(i-lb1),1);
259 }
260
261 INLINE cmatrix_subv cmatrix::operator [](const cxscmatrix_column &i)
262#if(CXSC_INDEX_CHECK)
263
264#else
265 noexcept
266#endif
267 {
268#if(CXSC_INDEX_CHECK)
269 if((i.col()<lb2)||(i.col()>ub2)) cxscthrow(ERROR_CMATRIX_ROW_OR_COL_NOT_IN_MAT("cmatrix_subv cmatrix::operator [](const cxscmatrix_column &i)"));
270#endif
271 return cmatrix_subv(dat, lb1, ub1, ysize, i.col()-lb2, xsize);
272 }
273
274 INLINE cmatrix_slice cmatrix::operator ()(const int &m, const int &n)
275#if(CXSC_INDEX_CHECK)
276
277#else
278 noexcept
279#endif
280 {
281#if(CXSC_INDEX_CHECK)
282 if((m<1)||(n<1)||(m<lb1)||(n<lb2)||(m>ub1)||(n>ub2)) cxscthrow(ERROR_CMATRIX_SUB_ARRAY_TOO_BIG("cmatrix_slice cmatrix::operator ()(const int &m, const int &n)"));
283#endif
284 return cmatrix_slice(*this,1,m,1,n);
285 }
286
287 INLINE cmatrix_slice cmatrix::operator ()(const int &m1, const int &m2, const int &n1, const int &n2)
288#if(CXSC_INDEX_CHECK)
289
290#else
291 noexcept
292#endif
293 {
294#if(CXSC_INDEX_CHECK)
295 if((m1<lb1)||(n1<lb2)||(m2>ub1)||(n2>ub2)) cxscthrow(ERROR_CMATRIX_SUB_ARRAY_TOO_BIG("cmatrix_slice cmatrix::operator ()(const int &m1, const int &n1, const int &m2, const int &n2)"));
296#endif
297 return cmatrix_slice(*this,m1,m2,n1,n2);
298 }
299
301#if(CXSC_INDEX_CHECK)
302
303#else
304 noexcept
305#endif
306 {
307#if(CXSC_INDEX_CHECK)
308 if((i<start1)||(i>end1)) cxscthrow(ERROR_CMATRIX_ROW_OR_COL_NOT_IN_MAT("cmatrix_subv cmatrix_slice::operator [](const int &i)"));
309#endif
310 return cmatrix_subv(dat, start2, end2, sxsize, mxsize*(i-start1+offset1)+offset2,1);
311 }
312
313 INLINE cmatrix_subv cmatrix_slice::operator [](const cxscmatrix_column &i)
314#if(CXSC_INDEX_CHECK)
315
316#else
317 noexcept
318#endif
319 {
320#if(CXSC_INDEX_CHECK)
321 if((i.col()<start2)||(i.col()>end2)) cxscthrow(ERROR_CMATRIX_ROW_OR_COL_NOT_IN_MAT("cmatrix_subv cmatrix_slice::operator [](const cxscmatrix_column &i)"));
322#endif
323 return cmatrix_subv(dat, start1, end1, sysize, offset1*mxsize+i.col()-start2+offset2, mxsize);
324 }
325
326 INLINE cmatrix_subv cmatrix_slice::operator [](const int &i) const
327#if(CXSC_INDEX_CHECK)
328
329#else
330 noexcept
331#endif
332 {
333#if(CXSC_INDEX_CHECK)
334 if((i<start1)||(i>end1)) cxscthrow(ERROR_CMATRIX_ROW_OR_COL_NOT_IN_MAT("cmatrix_subv cmatrix_slice::operator [](const int &i)"));
335#endif
336 return cmatrix_subv(dat, start2, end2, sxsize, mxsize*(i-start1+offset1)+offset2,1);
337 }
338
339 INLINE cmatrix_subv cmatrix_slice::operator [](const cxscmatrix_column &i) const
340#if(CXSC_INDEX_CHECK)
341
342#else
343 noexcept
344#endif
345 {
346#if(CXSC_INDEX_CHECK)
347 if((i.col()<start2)||(i.col()>end2)) cxscthrow(ERROR_CMATRIX_ROW_OR_COL_NOT_IN_MAT("cmatrix_subv cmatrix_slice::operator [](const cxscmatrix_column &i)"));
348#endif
349 return cmatrix_subv(dat, start1, end1, sysize, offset1*mxsize+i.col()-start2+offset2, mxsize);
350 }
351
352 INLINE cmatrix_slice cmatrix_slice::operator ()(const int &m, const int &n)
353#if(CXSC_INDEX_CHECK)
354
355#else
356 noexcept
357#endif
358 {
359#if(CXSC_INDEX_CHECK)
360 if((m<1)||(n<1)||(m<start1)||(n<start2)||(m>end1)||(n>end2)) cxscthrow(ERROR_CMATRIX_SUB_ARRAY_TOO_BIG("cmatrix_slice cmatrix_slice::operator ()(const int &m, const int &n)"));
361#endif
362 return cmatrix_slice(*this,1,m,1,n);
363 }
364
365 INLINE cmatrix_slice cmatrix_slice::operator ()(const int &m1, const int &m2, const int &n1, const int &n2)
366#if(CXSC_INDEX_CHECK)
367
368#else
369 noexcept
370#endif
371 {
372#if(CXSC_INDEX_CHECK)
373 if((m1<start1)||(n1<start2)||(m2>end1)||(n2>end2)) cxscthrow(ERROR_CMATRIX_SUB_ARRAY_TOO_BIG("cmatrix_slice cmatrix_slice::operator ()(const int &m1, const int &m2, const int &n1, const int &n2)"));
374#endif
375 return cmatrix_slice(*this,m1,m2,n1,n2);
376 }
377
379#if(CXSC_INDEX_CHECK)
380
381#else
382 noexcept
383#endif
384{
385#if(CXSC_INDEX_CHECK)
386 if(1<lb||i>ub) cxscthrow(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG("cmatrix_subv cmatrix_subv::operator ()(const int &i)"));
387#endif
388 return cmatrix_subv(dat,1,i,i,start+(1-lb)*offset,offset);
389}
390
391INLINE cmatrix_subv cmatrix_subv::operator ()(const int &i1,const int &i2)
392#if(CXSC_INDEX_CHECK)
393
394#else
395 noexcept
396#endif
397{
398#if(CXSC_INDEX_CHECK)
399 if(i1<lb||i2>ub) cxscthrow(ERROR_CVECTOR_SUB_ARRAY_TOO_BIG("cmatrix_subv cmatrix_subv::operator ()(const int &i1,const int &i2)"));
400#endif
401 return cmatrix_subv(dat,i1,i2,i2-i1+1,start+(i1-lb)*offset,offset);
402}
403
404
405
406 INLINE cmatrix_subv &cmatrix_subv::operator =(const cmatrix_subv &rv) noexcept { return _mvmvassign(*this,rv); }
407 INLINE cmatrix_subv &cmatrix_subv::operator =(const complex &r) noexcept { return _mvsassign(*this,r); }
409#if(CXSC_INDEX_CHECK)
410
411#else
412 noexcept
413#endif
414 { return _mvvassign(*this,v); }
416#if(CXSC_INDEX_CHECK)
417
418#else
419 noexcept
420#endif
421 { return _mvvassign(*this,cvector(v)); }
422 INLINE cmatrix_subv &cmatrix_subv::operator =(const rmatrix_subv &rv) noexcept { return _mvvassign(*this,rvector(rv)); }
423 INLINE cmatrix_subv &cmatrix_subv::operator =(const real &r) noexcept { return _mvsassign(*this,r); }
425#if(CXSC_INDEX_CHECK)
426
427#else
428 noexcept
429#endif
430 { return _mvvassign(*this,v); }
432#if(CXSC_INDEX_CHECK)
433
434#else
435 noexcept
436#endif
437 { return _mvvassign(*this,cvector(v)); }
438 INLINE cmatrix &cmatrix::operator =(const complex &r) noexcept { return _msassign(*this,r); }
439 INLINE cmatrix &cmatrix::operator =(const cmatrix &m) noexcept { return _mmassign<cmatrix,cmatrix,complex>(*this,m, complex(0,0)); }
440 INLINE cmatrix &cmatrix::operator =(const cmatrix_slice &ms) noexcept { return _mmsassign<cmatrix,cmatrix_slice,complex>(*this,ms); }
441 INLINE cmatrix &cmatrix::operator =(const cvector &v) noexcept { return _mvassign<cmatrix,cvector,complex>(*this,v); }
442 INLINE cmatrix &cmatrix::operator =(const cvector_slice &v) noexcept { return _mvassign<cmatrix,cvector,complex>(*this,cvector(v)); }
443 INLINE cmatrix &cmatrix::operator =(const real &r) noexcept { return _msassign(*this,complex(r)); }
444 INLINE cmatrix &cmatrix::operator =(const rmatrix &m) noexcept { return _mmassign<cmatrix,rmatrix,complex>(*this,m,complex(0,0)); }
445 INLINE cmatrix &cmatrix::operator =(const rmatrix_slice &ms) noexcept { return _mmsassign<cmatrix,rmatrix_slice,complex>(*this,ms); }
446 INLINE cmatrix &cmatrix::operator =(const rvector &v) noexcept { return _mvassign<cmatrix,rvector,complex>(*this,v); }
447 INLINE cmatrix &cmatrix::operator =(const rvector_slice &v) noexcept { return _mvassign<cmatrix,rvector,complex>(*this,rvector(v)); }
448
449 INLINE cmatrix::operator void*() noexcept { return _mvoid(*this); }
451#if(CXSC_INDEX_CHECK)
452
453#else
454 noexcept
455#endif
456 { return _msmassign(*this,m); }
458#if(CXSC_INDEX_CHECK)
459
460#else
461 noexcept
462#endif
463 { return _msmsassign(*this,ms); }
464 INLINE cmatrix_slice &cmatrix_slice::operator =(const complex &r) noexcept { return _mssassign(*this,r); }
466#if(CXSC_INDEX_CHECK)
467
468#else
469 noexcept
470#endif
471 { return _msmassign(*this,cmatrix(v)); }
473#if(CXSC_INDEX_CHECK)
474
475#else
476 noexcept
477#endif
478 { return _msmassign(*this,cmatrix(cvector(v))); }
480#if(CXSC_INDEX_CHECK)
481
482#else
483 noexcept
484#endif
485 { return _msmassign(*this,m); }
487#if(CXSC_INDEX_CHECK)
488
489#else
490 noexcept
491#endif
492 { return _msmsassign(*this,ms); }
493 INLINE cmatrix_slice &cmatrix_slice::operator =(const real &r) noexcept { return _mssassign(*this,r); }
495#if(CXSC_INDEX_CHECK)
496
497#else
498 noexcept
499#endif
500 { return _msmassign(*this,rmatrix(v)); }
502#if(CXSC_INDEX_CHECK)
503
504#else
505 noexcept
506#endif
507 { return _msmassign(*this,rmatrix(rvector(v))); }
508 INLINE cmatrix_slice::operator void*() noexcept { return _msvoid(*this); }
509 INLINE cvector operator /(const cmatrix_subv &rv, const complex &s) noexcept { return _mvsdiv<cmatrix_subv,complex,cvector>(rv,s); }
510 INLINE cvector operator *(const cmatrix_subv &rv, const complex &s) noexcept { return _mvsmult<cmatrix_subv,complex,cvector>(rv,s); }
511 INLINE cvector operator *(const complex &s, const cmatrix_subv &rv) noexcept { return _mvsmult<cmatrix_subv,complex,cvector>(rv,s); }
512 INLINE cmatrix_subv &cmatrix_subv::operator *=(const complex &c) noexcept { return _mvsmultassign(*this,c); }
513 INLINE cmatrix_subv &cmatrix_subv::operator +=(const complex &c) noexcept { return _mvsplusassign(*this,c); }
514 INLINE cmatrix_subv &cmatrix_subv::operator -=(const complex &c) noexcept { return _mvsminusassign(*this,c); }
515 INLINE cmatrix_subv &cmatrix_subv::operator /=(const complex &c) noexcept { return _mvsdivassign(*this,c); }
516 INLINE rvector abs(const cmatrix_subv &mv) noexcept { return _mvabs<cmatrix_subv,rvector>(mv); }
517 INLINE rvector Im(const cmatrix_subv &mv) noexcept { return _mvim<cmatrix_subv,rvector>(mv); }
518 INLINE rvector Re(const cmatrix_subv &mv) noexcept { return _mvre<cmatrix_subv,rvector>(mv); }
519 INLINE cmatrix_subv &SetIm(cmatrix_subv &mv,const rvector &rv)
520#if(CXSC_INDEX_CHECK)
521
522#else
523 noexcept
524#endif
525 { return _mvvsetim(mv,rv); }
526 INLINE cmatrix_subv &SetRe(cmatrix_subv &mv,const rvector &rv)
527#if(CXSC_INDEX_CHECK)
528
529#else
530 noexcept
531#endif
532 { return _mvvsetre(mv,rv); }
533 INLINE cmatrix_subv &SetRe(cmatrix_subv &iv,const real &r) noexcept { return _mvssetre(iv,r); }
534 INLINE cmatrix_subv &SetIm(cmatrix_subv &iv,const real &r) noexcept { return _mvssetim(iv,r); }
535 INLINE cvector &cvector::operator =(const cmatrix_subv &mv) noexcept { return _vmvassign<cvector,cmatrix_subv,complex>(*this,mv); }
536 INLINE cvector_slice &cvector_slice::operator =(const cmatrix_subv &mv) noexcept { return _vsvassign(*this,cvector(mv)); }
537
538 INLINE complex operator *(const cmatrix_subv & rv1, const cmatrix_subv &rv2)
539#if(CXSC_INDEX_CHECK)
540
541#else
542 noexcept
543#endif
544 { return _mvmvcmult<cmatrix_subv,cmatrix_subv,complex>(rv1,rv2); }
545 INLINE complex operator *(const cvector & rv1, const cmatrix_subv &rv2)
546#if(CXSC_INDEX_CHECK)
547
548#else
549 noexcept
550#endif
551 { return _vmvcmult<cvector,cmatrix_subv,complex>(rv1,rv2); }
552 INLINE complex operator *(const cmatrix_subv &rv1,const cvector &rv2)
553#if(CXSC_INDEX_CHECK)
554
555#else
556 noexcept
557#endif
558 { return _vmvcmult<cvector,cmatrix_subv,complex>(rv2,rv1); }
559 INLINE complex operator *(const cvector_slice &sl,const cmatrix_subv &sv)
560#if(CXSC_INDEX_CHECK)
561
562#else
563 noexcept
564#endif
565 { return _vmvcmult<cvector,cmatrix_subv,complex>(cvector(sl),sv); }
566 INLINE complex operator *(const cmatrix_subv &mv,const cvector_slice &vs)
567#if(CXSC_INDEX_CHECK)
568
569#else
570 noexcept
571#endif
572 { return _vmvcmult<cvector,cmatrix_subv,complex>(cvector(vs),mv); }
573 INLINE cvector operator +(const cmatrix_subv & rv1, const cmatrix_subv &rv2)
574#if(CXSC_INDEX_CHECK)
575
576#else
577 noexcept
578#endif
579 { return _mvmvplus<cmatrix_subv,cmatrix_subv,cvector>(rv1,rv2); }
580 INLINE cvector operator +(const cmatrix_subv &rv1,const cvector &rv2)
581#if(CXSC_INDEX_CHECK)
582
583#else
584 noexcept
585#endif
586 { return _mvvplus<cmatrix_subv,cvector,cvector>(rv1,rv2); }
587 INLINE cvector operator +(const cvector & rv1, const cmatrix_subv &rv2)
588#if(CXSC_INDEX_CHECK)
589
590#else
591 noexcept
592#endif
593 { return _mvvplus<cmatrix_subv,cvector,cvector>(rv2,rv1); }
594 INLINE cvector operator +(const cvector_slice &sl,const cmatrix_subv &mv)
595#if(CXSC_INDEX_CHECK)
596
597#else
598 noexcept
599#endif
600 { return _mvvplus<cmatrix_subv,cvector,cvector>(mv,cvector(sl)); }
601 INLINE cvector operator +(const cmatrix_subv &mv,const cvector_slice &sl)
602#if(CXSC_INDEX_CHECK)
603
604#else
605 noexcept
606#endif
607 { return _mvvplus<cmatrix_subv,cvector,cvector>(mv,cvector(sl)); }
609#if(CXSC_INDEX_CHECK)
610
611#else
612 noexcept
613#endif
614 { return _mvvplusassign(*this,rv); }
616#if(CXSC_INDEX_CHECK)
617
618#else
619 noexcept
620#endif
621 { return _mvvplusassign(*this,cvector(rv)); }
622 INLINE cvector operator -(const cmatrix_subv & rv1, const cmatrix_subv &rv2)
623#if(CXSC_INDEX_CHECK)
624
625#else
626 noexcept
627#endif
628 { return _mvmvminus<cmatrix_subv,cmatrix_subv,cvector>(rv1,rv2); }
629 INLINE cvector operator -(const cvector & rv1, const cmatrix_subv &rv2)
630#if(CXSC_INDEX_CHECK)
631
632#else
633 noexcept
634#endif
635 { return _vmvminus<cvector,cmatrix_subv,cvector>(rv1,rv2); }
636 INLINE cvector operator -(const cmatrix_subv &rv1,const cvector &rv2)
637#if(CXSC_INDEX_CHECK)
638
639#else
640 noexcept
641#endif
642 { return _mvvminus<cmatrix_subv,cvector,cvector>(rv1,rv2); }
643 INLINE cvector operator -(const cvector_slice &sl,const cmatrix_subv &mv)
644#if(CXSC_INDEX_CHECK)
645
646#else
647 noexcept
648#endif
649 { return _vmvminus<cvector,cmatrix_subv,cvector>(cvector(sl),mv); }
650 INLINE cvector operator -(const cmatrix_subv &mv,const cvector_slice &sl)
651#if(CXSC_INDEX_CHECK)
652
653#else
654 noexcept
655#endif
656 { return _mvvminus<cmatrix_subv,cvector,cvector>(mv,cvector(sl)); }
658#if(CXSC_INDEX_CHECK)
659
660#else
661 noexcept
662#endif
663 { return _mvvminusassign(*this,rv); }
665#if(CXSC_INDEX_CHECK)
666
667#else
668 noexcept
669#endif
670 { return _mvvminusassign(*this,cvector(rv)); }
671// real
672
674#if(CXSC_INDEX_CHECK)
675
676#else
677 noexcept
678#endif
679 { return _mvvplusassign(*this,rv); }
681#if(CXSC_INDEX_CHECK)
682
683#else
684 noexcept
685#endif
686 { return _mvvplusassign(*this,cvector(rv)); }
688#if(CXSC_INDEX_CHECK)
689
690#else
691 noexcept
692#endif
693 { return _mvvminusassign(*this,rv); }
695#if(CXSC_INDEX_CHECK)
696
697#else
698 noexcept
699#endif
700 { return _mvvminusassign(*this,rvector(rv)); }
701
702// matrix x matrix
708 INLINE cmatrix _cmatrix(const cmatrix &rm) noexcept { return rm; }
714 INLINE cmatrix _cmatrix(const cvector &v) noexcept { return cmatrix(v); }
720 INLINE cmatrix _cmatrix(const cvector_slice &v) noexcept { return cmatrix(v); }
726 INLINE cmatrix _cmatrix(const complex &r) noexcept { return cmatrix(r); }
727 INLINE int Lb(const cmatrix &rm, const int &i)
728#if(CXSC_INDEX_CHECK)
729
730#else
731 noexcept
732#endif
733 { return _mlb(rm,i); }
734 INLINE int Ub(const cmatrix &rm, const int &i)
735#if(CXSC_INDEX_CHECK)
736
737#else
738 noexcept
739#endif
740 { return _mub(rm,i); }
741 INLINE int Lb(const cmatrix_slice &rm, const int &i)
742#if(CXSC_INDEX_CHECK)
743
744#else
745 noexcept
746#endif
747 { return _mslb(rm,i); }
748 INLINE int Ub(const cmatrix_slice &rm, const int &i)
749#if(CXSC_INDEX_CHECK)
750
751#else
752 noexcept
753#endif
754 { return _msub(rm,i); }
755 INLINE cmatrix &SetLb(cmatrix &m, const int &i,const int &j)
756#if(CXSC_INDEX_CHECK)
757
758#else
759 noexcept
760#endif
761 { return _msetlb(m,i,j); }
762 INLINE cmatrix &SetUb(cmatrix &m, const int &i,const int &j)
763#if(CXSC_INDEX_CHECK)
764
765#else
766 noexcept
767#endif
768 { return _msetub(m,i,j); }
769
770 INLINE int RowLen ( const cmatrix& A ) // Length of the rows of a complex matrix
771 { return Ub(A,2)-Lb(A,2)+1; } //---------------------------------------
772
773 INLINE int ColLen ( const cmatrix& A ) // Length of the columns of a complex matrix
774 { return Ub(A,1)-Lb(A,1)+1; } //------------------------------------------
775
776 INLINE int RowLen ( const cmatrix_slice& A ) // Length of the rows of a complex matrix
777 { return Ub(A,2)-Lb(A,2)+1; } //---------------------------------------
778
779 INLINE int ColLen ( const cmatrix_slice& A ) // Length of the columns of a complex matrix
780 { return Ub(A,1)-Lb(A,1)+1; } //------------------------------------------
781
782 INLINE void Resize(cmatrix &A) noexcept { _mresize(A);}
783 INLINE void Resize(cmatrix &A,const int &m, const int &n)
784#if(CXSC_INDEX_CHECK)
785
786#else
787 noexcept
788#endif
789 { _mresize<cmatrix,complex>(A,m,n); }
790 INLINE void Resize(cmatrix &A,const int &m1, const int &m2,const int &n1,const int &n2)
791#if(CXSC_INDEX_CHECK)
792
793#else
794 noexcept
795#endif
796 { _mresize<cmatrix,complex>(A,m1,m2,n1,n2); }
797 INLINE rmatrix abs(const cmatrix &m) noexcept { return _mabs<cmatrix,rmatrix>(m); }
798 INLINE rmatrix abs(const cmatrix_slice &ms) noexcept { return _msabs<cmatrix_slice,rmatrix>(ms); }
799 INLINE rmatrix Im(const cmatrix &m) noexcept { return _mim<cmatrix,rmatrix>(m); }
800 INLINE rmatrix Re(const cmatrix &m) noexcept { return _mre<cmatrix,rmatrix>(m); }
801 INLINE rmatrix Im(const cmatrix_slice &m) noexcept { return _msim<cmatrix_slice,rmatrix>(m); }
802 INLINE rmatrix Re(const cmatrix_slice &m) noexcept { return _msre<cmatrix_slice,rmatrix>(m); }
803 INLINE cmatrix &SetIm(cmatrix &cm,const rmatrix &rm)
804#if(CXSC_INDEX_CHECK)
805
806#else
807 noexcept
808#endif
809 { return _mmsetim<cmatrix,rmatrix>(cm,rm); }
810 INLINE cmatrix_slice &SetIm(cmatrix_slice &cm,const rmatrix &rm)
811#if(CXSC_INDEX_CHECK)
812
813#else
814 noexcept
815#endif
816 { return _msmsetim<cmatrix_slice,rmatrix>(cm,rm); }
817 INLINE cmatrix &SetIm(cmatrix &cm,const rmatrix_slice &rm)
818#if(CXSC_INDEX_CHECK)
819
820#else
821 noexcept
822#endif
823 { return _mmssetim<cmatrix,rmatrix_slice>(cm,rm); }
824 INLINE cmatrix_slice &SetIm(cmatrix_slice &cm,const rmatrix_slice &rm)
825#if(CXSC_INDEX_CHECK)
826
827#else
828 noexcept
829#endif
830 { return _msmssetim<cmatrix_slice,rmatrix_slice>(cm,rm); }
831 INLINE cmatrix &SetRe(cmatrix &cm,const rmatrix &rm)
832#if(CXSC_INDEX_CHECK)
833
834#else
835 noexcept
836#endif
837 { return _mmsetre<cmatrix,rmatrix>(cm,rm); }
838 INLINE cmatrix_slice &SetRe(cmatrix_slice &cm,const rmatrix &rm)
839#if(CXSC_INDEX_CHECK)
840
841#else
842 noexcept
843#endif
844 { return _msmsetre<cmatrix_slice,rmatrix>(cm,rm); }
845 INLINE cmatrix &SetRe(cmatrix &cm,const rmatrix_slice &rm)
846#if(CXSC_INDEX_CHECK)
847
848#else
849 noexcept
850#endif
851 { return _mmssetre<cmatrix,rmatrix_slice>(cm,rm); }
852 INLINE cmatrix_slice &SetRe(cmatrix_slice &cm,const rmatrix_slice &rm)
853#if(CXSC_INDEX_CHECK)
854
855#else
856 noexcept
857#endif
858 { return _msmssetre<cmatrix_slice,rmatrix_slice>(cm,rm); }
859 INLINE complex::complex(const cmatrix &m)
860#if(CXSC_INDEX_CHECK)
861
862#else
863 noexcept
864#endif
865 { _smconstr(*this,m); }
866// INLINE complex complex::_complex(const cmatrix &m) { _smconstr(*this,m); return *this; }
867 INLINE cmatrix operator *(const complex &c, const cmatrix &m) noexcept { return _smmult<complex,cmatrix,cmatrix>(c,m); }
868 INLINE cmatrix operator *(const complex &c, const cmatrix_slice &ms) noexcept { return _smsmult<complex,cmatrix_slice,cmatrix>(c,ms); }
869 INLINE cmatrix operator *(const cmatrix &m,const complex &c) noexcept { return _smmult<complex,cmatrix,cmatrix>(c,m); }
870 INLINE cmatrix operator *(const cmatrix_slice &ms,const complex &c) noexcept { return _smsmult<complex,cmatrix_slice,cmatrix>(c,ms); }
871 INLINE cmatrix &operator *=(cmatrix &m,const complex &c) noexcept { return _msmultassign(m,c); }
873#if(CXSC_INDEX_CHECK)
874
875#else
876 noexcept
877#endif
878 { return (*this=*this*m); }
880#if(CXSC_INDEX_CHECK)
881
882#else
883 noexcept
884#endif
885 { return (*this=*this*m); }
886 INLINE cmatrix_slice &cmatrix_slice::operator *=(const complex &c) noexcept { return _mssmultassign(*this,c); }
887 INLINE cmatrix operator /(const cmatrix &m,const complex &c) noexcept { return _msdiv<cmatrix,complex,cmatrix>(m,c); }
888 INLINE cmatrix operator /(const cmatrix_slice &ms, const complex &c) noexcept { return _mssdiv<cmatrix_slice,complex,cmatrix>(ms,c); }
889 INLINE cmatrix &operator /=(cmatrix &m,const complex &c) noexcept { return _msdivassign(m,c); }
890 INLINE cmatrix_slice &cmatrix_slice::operator /=(const complex &c) noexcept { return _mssdivassign(*this,c); }
891 INLINE cmatrix operator *(const real &c, const cmatrix &m) noexcept { return _smmult<real,cmatrix,cmatrix>(c,m); }
892 INLINE cmatrix operator *(const real &c, const cmatrix_slice &ms) noexcept { return _smsmult<real,cmatrix_slice,cmatrix>(c,ms); }
893 INLINE cmatrix operator *(const cmatrix &m,const real &c) noexcept { return _smmult<real,cmatrix,cmatrix>(c,m); }
894 INLINE cmatrix operator *(const cmatrix_slice &ms,const real &c) noexcept { return _smsmult<real,cmatrix_slice,cmatrix>(c,ms); }
895 INLINE cmatrix &operator *=(cmatrix &m,const real &c) noexcept { return _msmultassign(m,c); }
897#if(CXSC_INDEX_CHECK)
898
899#else
900 noexcept
901#endif
902 { return (*this=*this*m); }
904#if(CXSC_INDEX_CHECK)
905
906#else
907 noexcept
908#endif
909 { return (*this=*this*m); }
910 INLINE cmatrix_slice &cmatrix_slice::operator *=(const real &c) noexcept { return _mssmultassign(*this,c); }
911 INLINE cmatrix operator /(const cmatrix &m,const real &c) noexcept { return _msdiv<cmatrix,real,cmatrix>(m,c); }
912 INLINE cmatrix operator /(const cmatrix_slice &ms, const real &c) noexcept { return _mssdiv<cmatrix_slice,real,cmatrix>(ms,c); }
913 INLINE cmatrix &operator /=(cmatrix &m,const real &c) noexcept { return _msdivassign(m,c); }
914 INLINE cmatrix_slice &cmatrix_slice::operator /=(const real &c) noexcept { return _mssdivassign(*this,c); }
915// INLINE complex::complex(const rmatrix &m) { _smconstr(*this,m); }
916// INLINE complex complex::_complex(const cmatrix &m) { _smconstr(*this,m); return *this; }
917 INLINE cmatrix operator *(const complex &c, const rmatrix &m) noexcept { return _smmult<complex,rmatrix,cmatrix>(c,m); }
918 INLINE cmatrix operator *(const complex &c, const rmatrix_slice &ms) noexcept { return _smsmult<complex,rmatrix_slice,cmatrix>(c,ms); }
919 INLINE cmatrix operator *(const rmatrix &m,const complex &c) noexcept { return _smmult<complex,rmatrix,cmatrix>(c,m); }
920 INLINE cmatrix operator *(const rmatrix_slice &ms,const complex &c) noexcept { return _smsmult<complex,rmatrix_slice,cmatrix>(c,ms); }
921 INLINE cmatrix operator /(const rmatrix &m,const complex &c) noexcept { return _msdiv<rmatrix,complex,cmatrix>(m,c); }
922 INLINE cmatrix operator /(const rmatrix_slice &ms, const complex &c) noexcept { return _mssdiv<rmatrix_slice,complex,cmatrix>(ms,c); }
923 INLINE cvector::cvector(const cmatrix &sl)
924#if(CXSC_INDEX_CHECK)
925
926#else
927 noexcept
928#endif
929 { _vmconstr<cvector,cmatrix,complex>(*this,sl); }
931#if(CXSC_INDEX_CHECK)
932
933#else
934 noexcept
935#endif
936 { _vmsconstr<cvector,cmatrix_slice,complex>(*this,sl); }
938#if(CXSC_INDEX_CHECK)
939
940#else
941 noexcept
942#endif
943 { return _vmassign<cvector,cmatrix,complex>(*this,m); }
945#if(CXSC_INDEX_CHECK)
946
947#else
948 noexcept
949#endif
950 { return _vmassign<cvector,cmatrix,complex>(*this,cmatrix(m)); }
952#if(CXSC_INDEX_CHECK)
953
954#else
955 noexcept
956#endif
957 { return _vsvassign(*this,cvector(cmatrix(m))); }
959#if(CXSC_INDEX_CHECK)
960
961#else
962 noexcept
963#endif
964 { return _mvvassign(*this,cvector(m)); }
966#if(CXSC_INDEX_CHECK)
967
968#else
969 noexcept
970#endif
971 { return _mvvassign(*this,cvector(cmatrix(m))); }
972 INLINE cvector operator *(const cmatrix &m,const cvector &v)
973#if(CXSC_INDEX_CHECK)
974
975#else
976 noexcept
977#endif
978 { return _mvcmult<cmatrix,cvector,cvector>(m,v); }
979 INLINE cvector operator *(const cmatrix_slice &ms,const cvector &v)
980#if(CXSC_INDEX_CHECK)
981
982#else
983 noexcept
984#endif
985 { return _msvcmult<cmatrix_slice,cvector,cvector>(ms,v); }
986 INLINE cvector operator *(const cvector &v,const cmatrix &m)
987#if(CXSC_INDEX_CHECK)
988
989#else
990 noexcept
991#endif
992 { return _vmcmult<cvector,cmatrix,cvector>(v,m); }
993 INLINE cvector operator *(const cvector &v,const cmatrix_slice &ms)
994#if(CXSC_INDEX_CHECK)
995
996#else
997 noexcept
998#endif
999 { return _vmscmult<cvector,cmatrix_slice,cvector>(v,ms); }
1000 INLINE cvector &operator *=(cvector &v,const cmatrix &m)
1001#if(CXSC_INDEX_CHECK)
1002
1003#else
1004 noexcept
1005#endif
1006 { return _vmcmultassign<cvector,cmatrix,complex>(v,m); }
1008#if(CXSC_INDEX_CHECK)
1009
1010#else
1011 noexcept
1012#endif
1013 { return _vmscmultassign<cvector,cmatrix_slice,complex>(v,ms); }
1015#if(CXSC_INDEX_CHECK)
1016
1017#else
1018 noexcept
1019#endif
1020 { return _vsmcmultassign<cvector_slice,cmatrix,complex>(*this,m); }
1021 INLINE cvector operator *(const cvector_slice &v,const cmatrix &m)
1022#if(CXSC_INDEX_CHECK)
1023
1024#else
1025 noexcept
1026#endif
1027 { return _vmcmult<cvector,cmatrix,cvector>(cvector(v),m); }
1029#if(CXSC_INDEX_CHECK)
1030
1031#else
1032 noexcept
1033#endif
1034 { return _vmscmult<cvector,cmatrix_slice,cvector>(cvector(v),m); }
1036#if(CXSC_INDEX_CHECK)
1037
1038#else
1039 noexcept
1040#endif
1041 { return _mvvassign(*this,rvector(m)); }
1043#if(CXSC_INDEX_CHECK)
1044
1045#else
1046 noexcept
1047#endif
1048 { return _mvvassign(*this,rvector(rmatrix(m))); }
1049 INLINE cvector operator *(const rvector &v,const cmatrix &m)
1050#if(CXSC_INDEX_CHECK)
1051
1052#else
1053 noexcept
1054#endif
1055 { return _vmcmult<rvector,cmatrix,cvector>(v,m); }
1056 INLINE cvector operator *(const rvector &v,const cmatrix_slice &ms)
1057#if(CXSC_INDEX_CHECK)
1058
1059#else
1060 noexcept
1061#endif
1062 { return _vmscmult<rvector,cmatrix_slice,cvector>(v,ms); }
1063 INLINE cvector operator *(const rvector_slice &v,const cmatrix &m)
1064#if(CXSC_INDEX_CHECK)
1065
1066#else
1067 noexcept
1068#endif
1069 { return _vmcmult<cvector,cmatrix,cvector>(cvector(v),m); }
1070 INLINE cvector operator *(const cmatrix &m,const rvector &v)
1071#if(CXSC_INDEX_CHECK)
1072
1073#else
1074 noexcept
1075#endif
1076 { return _mvcmult<cmatrix,rvector,cvector>(m,v); }
1077 INLINE cvector operator *(const cmatrix_slice &ms,const rvector &v)
1078#if(CXSC_INDEX_CHECK)
1079
1080#else
1081 noexcept
1082#endif
1083 { return _msvcmult<cmatrix_slice,rvector,cvector>(ms,v); }
1084
1085 INLINE const cmatrix &operator +(const cmatrix &m) noexcept { return m; }
1086 INLINE cmatrix operator +(const cmatrix_slice &m) noexcept { return cmatrix(m); }
1087 INLINE cmatrix operator +(const cmatrix &m1,const cmatrix &m2)
1088#if(CXSC_INDEX_CHECK)
1089
1090#else
1091 noexcept
1092#endif
1093 { return _mmplus<cmatrix,cmatrix,cmatrix>(m1,m2); }
1094 INLINE cmatrix operator +(const cmatrix &m,const cmatrix_slice &ms)
1095#if(CXSC_INDEX_CHECK)
1096
1097#else
1098 noexcept
1099#endif
1100 { return _mmsplus<cmatrix,cmatrix_slice,cmatrix>(m,ms); }
1101 INLINE cmatrix operator +(const cmatrix_slice &ms,const cmatrix &m)
1102#if(CXSC_INDEX_CHECK)
1103
1104#else
1105 noexcept
1106#endif
1107 { return _mmsplus<cmatrix,cmatrix_slice,cmatrix>(m,ms); }
1108 INLINE cmatrix operator +(const cmatrix_slice &m1,const cmatrix_slice &m2)
1109#if(CXSC_INDEX_CHECK)
1110
1111#else
1112 noexcept
1113#endif
1114 { return _msmsplus<cmatrix_slice,cmatrix_slice,cmatrix>(m1,m2); }
1115 INLINE cmatrix &operator +=(cmatrix &m1,const cmatrix &m2)
1116#if(CXSC_INDEX_CHECK)
1117
1118#else
1119 noexcept
1120#endif
1121 { return _mmplusassign(m1,m2); }
1123#if(CXSC_INDEX_CHECK)
1124
1125#else
1126 noexcept
1127#endif
1128 { return _mmsplusassign(m1,ms); }
1130#if(CXSC_INDEX_CHECK)
1131
1132#else
1133 noexcept
1134#endif
1135 { return _msmplusassign(*this,m1); }
1137#if(CXSC_INDEX_CHECK)
1138
1139#else
1140 noexcept
1141#endif
1142 { return _msmsplusassign(*this,ms2); }
1143 INLINE cmatrix operator -(const cmatrix &m) noexcept { return _mminus(m); }
1144 INLINE cmatrix operator -(const cmatrix_slice &m) noexcept { return _msminus<cmatrix_slice,cmatrix>(m); }
1145 INLINE cmatrix operator -(const cmatrix &m1,const cmatrix &m2)
1146#if(CXSC_INDEX_CHECK)
1147
1148#else
1149 noexcept
1150#endif
1151 { return _mmminus<cmatrix,cmatrix,cmatrix>(m1,m2); }
1152 INLINE cmatrix operator -(const cmatrix &m,const cmatrix_slice &ms)
1153#if(CXSC_INDEX_CHECK)
1154
1155#else
1156 noexcept
1157#endif
1158 { return _mmsminus<cmatrix,cmatrix_slice,cmatrix>(m,ms); }
1159 INLINE cmatrix operator -(const cmatrix_slice &ms,const cmatrix &m)
1160#if(CXSC_INDEX_CHECK)
1161
1162#else
1163 noexcept
1164#endif
1165 { return _msmminus<cmatrix_slice,cmatrix,cmatrix>(ms,m); }
1166 INLINE cmatrix operator -(const cmatrix_slice &ms1,const cmatrix_slice &ms2)
1167#if(CXSC_INDEX_CHECK)
1168
1169#else
1170 noexcept
1171#endif
1172 { return _msmsminus<cmatrix_slice,cmatrix_slice,cmatrix>(ms1,ms2); }
1173 INLINE cmatrix &operator -=(cmatrix &m1,const cmatrix &m2)
1174#if(CXSC_INDEX_CHECK)
1175
1176#else
1177 noexcept
1178#endif
1179 { return _mmminusassign(m1,m2); }
1180 INLINE cmatrix &operator -=(cmatrix &m1,const cmatrix_slice &ms)
1181#if(CXSC_INDEX_CHECK)
1182
1183#else
1184 noexcept
1185#endif
1186 { return _mmsminusassign(m1,ms); }
1188#if(CXSC_INDEX_CHECK)
1189
1190#else
1191 noexcept
1192#endif
1193 { return _msmminusassign(*this,m1); }
1195#if(CXSC_INDEX_CHECK)
1196
1197#else
1198 noexcept
1199#endif
1200 { return _msmsminusassign(*this,ms2); }
1201 INLINE cmatrix operator *(const cmatrix &m1, const cmatrix &m2)
1202#if(CXSC_INDEX_CHECK)
1203
1204#else
1205 noexcept
1206#endif
1207 { return _mmcmult<cmatrix,cmatrix,cmatrix>(m1,m2); }
1208 INLINE cmatrix operator *(const cmatrix &m1, const cmatrix_slice &ms)
1209#if(CXSC_INDEX_CHECK)
1210
1211#else
1212 noexcept
1213#endif
1214 { return _mmscmult<cmatrix,cmatrix_slice,cmatrix>(m1,ms); }
1215 INLINE cmatrix operator *(const cmatrix_slice &ms, const cmatrix &m1)
1216#if(CXSC_INDEX_CHECK)
1217
1218#else
1219 noexcept
1220#endif
1221 { return _msmcmult<cmatrix_slice,cmatrix,cmatrix>(ms,m1); }
1222 INLINE cmatrix operator *(const cmatrix_slice &ms1, const cmatrix_slice &ms2)
1223#if(CXSC_INDEX_CHECK)
1224
1225#else
1226 noexcept
1227#endif
1228 { return _msmscmult<cmatrix_slice,cmatrix_slice,cmatrix>(ms1,ms2); }
1229 INLINE cmatrix &operator *=(cmatrix &m1,const cmatrix &m2)
1230#if(CXSC_INDEX_CHECK)
1231
1232#else
1233 noexcept
1234#endif
1235 { return _mmcmultassign<cmatrix,cmatrix,complex>(m1,m2); }
1237#if(CXSC_INDEX_CHECK)
1238
1239#else
1240 noexcept
1241#endif
1242 { return _mmscmultassign<cmatrix,cmatrix_slice,complex>(m1,ms); }
1243 INLINE cmatrix operator +(const rmatrix &m1,const cmatrix &m2)
1244#if(CXSC_INDEX_CHECK)
1245
1246#else
1247 noexcept
1248#endif
1249 { return _mmplus<rmatrix,cmatrix,cmatrix>(m1,m2); }
1250 INLINE cmatrix operator +(const cmatrix &m1,const rmatrix &m2)
1251#if(CXSC_INDEX_CHECK)
1252
1253#else
1254 noexcept
1255#endif
1256 { return _mmplus<rmatrix,cmatrix,cmatrix>(m2,m1); }
1257 INLINE cmatrix operator +(const rmatrix &m,const cmatrix_slice &ms)
1258#if(CXSC_INDEX_CHECK)
1259
1260#else
1261 noexcept
1262#endif
1263 { return _mmsplus<rmatrix,cmatrix_slice,cmatrix>(m,ms); }
1264 INLINE cmatrix operator +(const cmatrix &m,const rmatrix_slice &ms)
1265#if(CXSC_INDEX_CHECK)
1266
1267#else
1268 noexcept
1269#endif
1270 { return _mmsplus<cmatrix,rmatrix_slice,cmatrix>(m,ms); }
1271 INLINE cmatrix operator +(const rmatrix_slice &ms,const cmatrix &m)
1272#if(CXSC_INDEX_CHECK)
1273
1274#else
1275 noexcept
1276#endif
1277 { return _mmsplus<cmatrix,rmatrix_slice,cmatrix>(m,ms); }
1278 INLINE cmatrix operator +(const cmatrix_slice &ms,const rmatrix &m)
1279#if(CXSC_INDEX_CHECK)
1280
1281#else
1282 noexcept
1283#endif
1284 { return _mmsplus<rmatrix,cmatrix_slice,cmatrix>(m,ms); }
1285 INLINE cmatrix operator +(const rmatrix_slice &m1,const cmatrix_slice &m2)
1286#if(CXSC_INDEX_CHECK)
1287
1288#else
1289 noexcept
1290#endif
1291 { return _msmsplus<rmatrix_slice,cmatrix_slice,cmatrix>(m1,m2); }
1292 INLINE cmatrix operator +(const cmatrix_slice &m1,const rmatrix_slice &m2)
1293#if(CXSC_INDEX_CHECK)
1294
1295#else
1296 noexcept
1297#endif
1298 { return _msmsplus<rmatrix_slice,cmatrix_slice,cmatrix>(m2,m1); }
1299 INLINE cmatrix &operator +=(cmatrix &m1,const rmatrix &m2)
1300#if(CXSC_INDEX_CHECK)
1301
1302#else
1303 noexcept
1304#endif
1305 { return _mmplusassign(m1,m2); }
1307#if(CXSC_INDEX_CHECK)
1308
1309#else
1310 noexcept
1311#endif
1312 { return _mmsplusassign(m1,ms); }
1314#if(CXSC_INDEX_CHECK)
1315
1316#else
1317 noexcept
1318#endif
1319 { return _msmplusassign(*this,m1); }
1321#if(CXSC_INDEX_CHECK)
1322
1323#else
1324 noexcept
1325#endif
1326 { return _msmsplusassign(*this,ms2); }
1327 INLINE cmatrix operator -(const rmatrix &m1,const cmatrix &m2)
1328#if(CXSC_INDEX_CHECK)
1329
1330#else
1331 noexcept
1332#endif
1333 { return _mmminus<rmatrix,cmatrix,cmatrix>(m1,m2); }
1334 INLINE cmatrix operator -(const cmatrix &m1,const rmatrix &m2)
1335#if(CXSC_INDEX_CHECK)
1336
1337#else
1338 noexcept
1339#endif
1340 { return _mmminus<cmatrix,rmatrix,cmatrix>(m1,m2); }
1341 INLINE cmatrix operator -(const rmatrix &m,const cmatrix_slice &ms)
1342#if(CXSC_INDEX_CHECK)
1343
1344#else
1345 noexcept
1346#endif
1347 { return _mmsminus<rmatrix,cmatrix_slice,cmatrix>(m,ms); }
1348 INLINE cmatrix operator -(const cmatrix &m,const rmatrix_slice &ms)
1349#if(CXSC_INDEX_CHECK)
1350
1351#else
1352 noexcept
1353#endif
1354 { return _mmsminus<cmatrix,rmatrix_slice,cmatrix>(m,ms); }
1355 INLINE cmatrix operator -(const rmatrix_slice &ms,const cmatrix &m)
1356#if(CXSC_INDEX_CHECK)
1357
1358#else
1359 noexcept
1360#endif
1361 { return _msmminus<rmatrix_slice,cmatrix,cmatrix>(ms,m); }
1362 INLINE cmatrix operator -(const cmatrix_slice &ms,const rmatrix &m)
1363#if(CXSC_INDEX_CHECK)
1364
1365#else
1366 noexcept
1367#endif
1368 { return _msmminus<cmatrix_slice,rmatrix,cmatrix>(ms,m); }
1369 INLINE cmatrix operator -(const rmatrix_slice &ms1,const cmatrix_slice &ms2)
1370#if(CXSC_INDEX_CHECK)
1371
1372#else
1373 noexcept
1374#endif
1375 { return _msmsminus<rmatrix_slice,cmatrix_slice,cmatrix>(ms1,ms2); }
1376 INLINE cmatrix operator -(const cmatrix_slice &ms1,const rmatrix_slice &ms2)
1377#if(CXSC_INDEX_CHECK)
1378
1379#else
1380 noexcept
1381#endif
1382 { return _msmsminus<cmatrix_slice,rmatrix_slice,cmatrix>(ms1,ms2); }
1383 INLINE cmatrix &operator -=(cmatrix &m1,const rmatrix &m2)
1384#if(CXSC_INDEX_CHECK)
1385
1386#else
1387 noexcept
1388#endif
1389 { return _mmminusassign(m1,m2); }
1390 INLINE cmatrix &operator -=(cmatrix &m1,const rmatrix_slice &ms)
1391#if(CXSC_INDEX_CHECK)
1392
1393#else
1394 noexcept
1395#endif
1396 { return _mmsminusassign(m1,ms); }
1398#if(CXSC_INDEX_CHECK)
1399
1400#else
1401 noexcept
1402#endif
1403 { return _msmminusassign(*this,m1); }
1405#if(CXSC_INDEX_CHECK)
1406
1407#else
1408 noexcept
1409#endif
1410 { return _msmsminusassign(*this,ms2); }
1411 INLINE cmatrix operator *(const rmatrix &m1, const cmatrix &m2)
1412#if(CXSC_INDEX_CHECK)
1413
1414#else
1415 noexcept
1416#endif
1417 { return _mmcmult<rmatrix,cmatrix,cmatrix>(m1,m2); }
1418 INLINE cmatrix operator *(const cmatrix &m1, const rmatrix &m2)
1419#if(CXSC_INDEX_CHECK)
1420
1421#else
1422 noexcept
1423#endif
1424 { return _mmcmult<cmatrix,rmatrix,cmatrix>(m1,m2); }
1425 INLINE cmatrix operator *(const rmatrix &m1, const cmatrix_slice &ms)
1426#if(CXSC_INDEX_CHECK)
1427
1428#else
1429 noexcept
1430#endif
1431 { return _mmscmult<rmatrix,cmatrix_slice,cmatrix>(m1,ms); }
1432 INLINE cmatrix operator *(const cmatrix &m1, const rmatrix_slice &ms)
1433#if(CXSC_INDEX_CHECK)
1434
1435#else
1436 noexcept
1437#endif
1438 { return _mmscmult<cmatrix,rmatrix_slice,cmatrix>(m1,ms); }
1439 INLINE cmatrix operator *(const rmatrix_slice &ms, const cmatrix &m1)
1440#if(CXSC_INDEX_CHECK)
1441
1442#else
1443 noexcept
1444#endif
1445 { return _msmcmult<rmatrix_slice,cmatrix,cmatrix>(ms,m1); }
1446 INLINE cmatrix operator *(const cmatrix_slice &ms, const rmatrix &m1)
1447#if(CXSC_INDEX_CHECK)
1448
1449#else
1450 noexcept
1451#endif
1452 { return _msmcmult<cmatrix_slice,rmatrix,cmatrix>(ms,m1); }
1453 INLINE cmatrix operator *(const rmatrix_slice &ms1, const cmatrix_slice &ms2)
1454#if(CXSC_INDEX_CHECK)
1455
1456#else
1457 noexcept
1458#endif
1459 { return _msmscmult<rmatrix_slice,cmatrix_slice,cmatrix>(ms1,ms2); }
1460 INLINE cmatrix operator *(const cmatrix_slice &ms1, const rmatrix_slice &ms2)
1461#if(CXSC_INDEX_CHECK)
1462
1463#else
1464 noexcept
1465#endif
1466 { return _msmscmult<cmatrix_slice,rmatrix_slice,cmatrix>(ms1,ms2); }
1467 INLINE cmatrix &operator *=(cmatrix &m1,const rmatrix &m2)
1468#if(CXSC_INDEX_CHECK)
1469
1470#else
1471 noexcept
1472#endif
1473 { return _mmcmultassign<cmatrix,rmatrix,complex>(m1,m2); }
1475#if(CXSC_INDEX_CHECK)
1476
1477#else
1478 noexcept
1479#endif
1480 { return _mmscmultassign<cmatrix,rmatrix_slice,complex>(m1,ms); }
1481 INLINE bool operator ==(const cmatrix &m1,const cmatrix &m2) noexcept { return _mmeq(m1,m2); }
1482 INLINE bool operator !=(const cmatrix &m1,const cmatrix &m2) noexcept { return _mmneq(m1,m2); }
1483/* INLINE bool operator <(const cmatrix &m1,const cmatrix &m2) noexcept { return _mmless(m1,m2); }
1484 INLINE bool operator <=(const cmatrix &m1,const cmatrix &m2) noexcept { return _mmleq(m1,m2); }
1485 INLINE bool operator >(const cmatrix &m1,const cmatrix &m2) noexcept { return _mmless(m2,m1); }
1486 INLINE bool operator >=(const cmatrix &m1,const cmatrix &m2) noexcept { return _mmleq(m2,m1); }
1487*/
1488 INLINE bool operator ==(const cmatrix &m1,const cmatrix_slice &ms) noexcept { return _mmseq(m1,ms); }
1489 INLINE bool operator !=(const cmatrix &m1,const cmatrix_slice &ms) noexcept { return _mmsneq(m1,ms); }
1490/* INLINE bool operator <(const cmatrix &m1,const cmatrix_slice &ms) noexcept { return _mmsless(m1,ms); }
1491 INLINE bool operator <=(const cmatrix &m1,const cmatrix_slice &ms) noexcept { return _mmsleq(m1,ms); }
1492 INLINE bool operator >(const cmatrix &m1,const cmatrix_slice &ms) noexcept { return _msmless(ms,m1); }
1493 INLINE bool operator >=(const cmatrix &m1,const cmatrix_slice &ms) noexcept { return _msmleq(ms,m1); }
1494*/
1495 INLINE bool operator ==(const cmatrix_slice &m1,const cmatrix_slice &m2) noexcept { return _msmseq(m1,m2); }
1496 INLINE bool operator !=(const cmatrix_slice &m1,const cmatrix_slice &m2) noexcept { return _msmsneq(m1,m2); }
1497/* INLINE bool operator <(const cmatrix_slice &m1,const cmatrix_slice &m2) noexcept { return _msmsless(m1,m2); }
1498 INLINE bool operator <=(const cmatrix_slice &m1,const cmatrix_slice &m2) noexcept { return _msmsleq(m1,m2); }
1499 INLINE bool operator >(const cmatrix_slice &m1,const cmatrix_slice &m2) noexcept { return _msmsless(m2,m1); }
1500 INLINE bool operator >=(const cmatrix_slice &m1,const cmatrix_slice &m2) noexcept { return _msmsleq(m2,m1); }
1501*/
1502 INLINE bool operator !(const cmatrix &ms) noexcept { return _mnot(ms); }
1503 INLINE bool operator !(const cmatrix_slice &ms) noexcept { return _msnot(ms); }
1504 INLINE std::ostream &operator <<(std::ostream &s,const cmatrix &r) noexcept { return _mout(s,r); }
1505 INLINE std::ostream &operator <<(std::ostream &s,const cmatrix_slice &r) noexcept { return _msout(s,r); }
1506 INLINE std::istream &operator >>(std::istream &s,cmatrix &r) noexcept { return _min(s,r); }
1507 INLINE std::istream &operator >>(std::istream &s,cmatrix_slice &r) noexcept { return _msin(s,r); }
1508
1510 INLINE cmatrix cmatrix::operator()(const intvector& p, const intvector& q) {
1511 cmatrix A(*this);
1512 for(int i=0 ; i<ColLen(A) ; i++)
1513 for(int j=0 ; j<RowLen(A) ; j++)
1514 A[i+Lb(A,1)][j+Lb(A,2)] = (*this)[p[i+Lb(p)]+Lb(A,1)][q[j+Lb(q)]+Lb(A,2)];
1515 return A;
1516 }
1517
1520 cmatrix A(*this);
1521 for(int i=0 ; i<ColLen(A) ; i++)
1522 A[i+Lb(A,1)] = (*this)[p[i+Lb(p)]+Lb(A,1)];
1523 return A;
1524 }
1525
1528 intvector p = permvec(P);
1529 return (*this)(p);
1530 }
1531
1533 INLINE cmatrix cmatrix::operator()(const intmatrix& P, const intmatrix& Q) {
1534 intvector p = permvec(P);
1535 intvector q = perminv(permvec(Q));
1536 return (*this)(p,q);
1537 }
1538
1541 intvector p = permvec(P);
1542 return (*this)(p);
1543 }
1544
1545} // namespace cxsc
1546
1547#endif
The Data Type cmatrix_slice.
Definition cmatrix.hpp:1203
cmatrix_slice & operator=(const cmatrix &m) noexcept
Implementation of standard assigning operator.
Definition cmatrix.inl:450
cmatrix_slice & operator-=(const srmatrix &m)
Implementation of addition and assignment operator.
cmatrix_subv operator[](const int &i) noexcept
Operator for accessing a single row of the matrix.
Definition cmatrix.inl:300
cmatrix_slice & operator/=(const complex &c) noexcept
Implementation of division and allocation operation.
Definition cmatrix.inl:890
cmatrix_slice & operator*=(const srmatrix &m)
Implementation of addition and assignment operator.
cmatrix_slice & operator()() noexcept
Operator for accessing the whole matrix.
Definition cmatrix.hpp:1698
cmatrix_slice & operator+=(const srmatrix &m)
Implementation of addition and assignment operator.
The Data Type cmatrix_subv.
Definition cmatrix.hpp:54
cmatrix_subv & operator=(const scmatrix_subv &rv)
Implementation of standard assigning operator.
cmatrix_subv & operator/=(const complex &c) noexcept
Implementation of division and allocation operation.
Definition cmatrix.inl:515
cmatrix_subv & operator-=(const scmatrix_subv &rv)
Implementation of standard assigning operator.
cmatrix_subv & operator+=(const scmatrix_subv &rv)
Implementation of standard assigning operator.
complex & operator[](const int &i) const noexcept
Operator for accessing the single elements of the vector (read-only)
Definition cmatrix.inl:195
cmatrix_subv & operator*=(const complex &c) noexcept
Implementation of multiplication and allocation operation.
Definition cmatrix.inl:512
cmatrix_subv & operator()() noexcept
Operator for accessing the whole vector.
Definition cmatrix.hpp:289
The Data Type cmatrix.
Definition cmatrix.hpp:514
cmatrix() noexcept
Constructor of class cmatrix.
Definition cmatrix.inl:31
cmatrix & operator()() noexcept
Operator for accessing the whole matrix.
Definition cmatrix.hpp:1175
cmatrix_subv operator[](const int &i) const noexcept
Operator for accessing a single row of the matrix.
Definition cmatrix.inl:222
cmatrix & operator=(const complex &r) noexcept
Implementation of standard assigning operator.
Definition cmatrix.inl:438
The Scalar Type complex.
Definition complex.hpp:50
complex(void) noexcept
Constructor of class complex.
Definition complex.hpp:59
The Data Type cvector_slice.
Definition cvector.hpp:845
cvector_slice & operator=(const scvector &sl)
Implementation of standard assigning operator.
cvector_slice & operator*=(const complex &r) noexcept
Implementation of multiplication and allocation operation.
Definition cvector.inl:423
The Data Type cvector.
Definition cvector.hpp:58
cvector() noexcept
Constructor of class cvector.
Definition cvector.inl:31
cvector & operator=(const cvector &rv) noexcept
Implementation of standard assigning operator.
Definition cvector.inl:276
cvector & operator()() noexcept
Operator for accessing the whole vector.
Definition cvector.hpp:817
The Data Type intmatrix.
The Data Type intvector.
Definition intvector.hpp:52
The Scalar Type real.
Definition real.hpp:114
The Data Type rmatrix_slice.
Definition rmatrix.hpp:1443
The Data Type rmatrix_subv.
Definition rmatrix.hpp:54
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
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
cmatrix _cmatrix(const cmatrix &rm) noexcept
Deprecated typecast, which only exist for the reason of compatibility with older versions of C-XSC.
Definition cmatrix.inl:708
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.
cimatrix_subv Row(cimatrix &m, const int &i) noexcept
Returns one row of the matrix as a vector.
Definition cimatrix.inl:231
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.