[53b1fd]: src / fixedCMatrix.h Maximize Restore History

Download this file

fixedCMatrix.h    414 lines (299 with data), 16.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
/*
Copyright (C) 2003 Motorola Inc
Copyright (C) 2003 David Bateman
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
In addition to the terms of the GPL, you are permitted to link
this program with any Open Source program, as defined by the
Open Source Initiative (www.opensource.org)
*/
#if !defined (octave_FixedCMatrix_h)
#define octave_FixedCMatrix_h 1
#include <octave/MArray.h>
#include <octave/mx-defs.h>
#include <octave/mx-op-defs.h>
#include <octave/data-conv.h>
#include <octave/mach-info.h>
#include <octave/boolMatrix.h>
#include <octave/dMatrix.h>
#include <octave/CMatrix.h>
#include "int/fixed.h"
#include "fixedMatrix.h"
#include "fixedComplex.h"
#if !defined(octave_FixedCColVector_h)
class FixedComplexColumnVector;
#endif
#if !defined(octave_FixedCRowVector_h)
class FixedComplexRowVector;
#endif
typedef FixedPointComplex (*fpc_fpc_Mapper)(FixedPointComplex);
class
OCTAVE_FIXED_API
FixedComplexMatrix : public MArray<FixedPointComplex>
{
public:
FixedComplexMatrix (void) : MArray<FixedPointComplex> () { }
FixedComplexMatrix (const dim_vector& dv) : MArray<FixedPointComplex> (dv) { }
FixedComplexMatrix (int r, int c)
: MArray<FixedPointComplex> (dim_vector (r, c)) { }
FixedComplexMatrix (int r, int c, const FixedPointComplex val)
: MArray<FixedPointComplex> (dim_vector (r, c), val) { }
FixedComplexMatrix (const MArray<int> &is, const MArray<int> &ds);
FixedComplexMatrix (const Matrix &is, const Matrix &ds);
FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix &ds);
FixedComplexMatrix (unsigned int is, unsigned int ds,
const FixedComplexMatrix& a);
FixedComplexMatrix (Complex is, Complex ds, const FixedComplexMatrix& a);
FixedComplexMatrix (const MArray<int> &is, const MArray<int> &ds,
const FixedComplexMatrix& a);
FixedComplexMatrix (const Matrix &is, const Matrix &ds,
const FixedComplexMatrix& a);
FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix &ds,
const FixedComplexMatrix& a);
FixedComplexMatrix (unsigned int is, unsigned int ds, const FixedMatrix& a);
FixedComplexMatrix (Complex is, Complex ds, const FixedMatrix& a);
FixedComplexMatrix (const MArray<int> &is, const MArray<int> &ds,
const FixedMatrix& a);
FixedComplexMatrix (const Matrix &is, const Matrix &ds,
const FixedMatrix& a);
FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix &ds,
const FixedMatrix& a);
FixedComplexMatrix (unsigned int is, unsigned int ds,
const ComplexMatrix& a);
FixedComplexMatrix (Complex is, Complex ds, const ComplexMatrix& a);
FixedComplexMatrix (const MArray<int> &is, const MArray<int> & ds,
const ComplexMatrix& a);
FixedComplexMatrix (const Matrix &is, const Matrix & ds,
const ComplexMatrix& a);
FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix & ds,
const ComplexMatrix& a);
FixedComplexMatrix (unsigned int is, unsigned int ds, const Matrix& a);
FixedComplexMatrix (Complex is, Complex ds, const Matrix& a);
FixedComplexMatrix (const MArray<int> &is, const MArray<int> & ds,
const Matrix& a);
FixedComplexMatrix (const Matrix &is, const Matrix & ds, const Matrix& a);
FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix & ds,
const Matrix& a);
FixedComplexMatrix (unsigned int is, unsigned int ds,
const ComplexMatrix &a, const ComplexMatrix &b);
FixedComplexMatrix (Complex is, Complex ds, const ComplexMatrix &a,
const ComplexMatrix &b);
FixedComplexMatrix (const MArray<int> &is, const MArray<int> &ds,
const ComplexMatrix &a, const ComplexMatrix &b);
FixedComplexMatrix (const Matrix &is, const Matrix &ds,
const ComplexMatrix &a, const ComplexMatrix &b);
FixedComplexMatrix (const ComplexMatrix &is, const ComplexMatrix &ds,
const ComplexMatrix &a, const ComplexMatrix &b);
FixedComplexMatrix (const FixedMatrix& a);
FixedComplexMatrix (const FixedMatrix& a, const FixedMatrix& b);
FixedComplexMatrix (const FixedComplexMatrix& a) :
MArray<FixedPointComplex> (a) { }
FixedComplexMatrix (const MArray<FixedPointComplex>& a) :
MArray<FixedPointComplex> (a) { }
FixedComplexMatrix (const Array<FixedPointComplex>& a) :
MArray<FixedPointComplex> (a) { }
explicit FixedComplexMatrix (const FixedComplexRowVector& rv);
FixedComplexMatrix (const FixedRowVector& rv);
explicit FixedComplexMatrix (const FixedComplexColumnVector& cv);
FixedComplexMatrix (const FixedColumnVector& cv);
ComplexMatrix sign (void) const;
ComplexMatrix getdecsize (void) const;
ComplexMatrix getintsize (void) const;
ComplexMatrix getnumber (void) const;
ComplexMatrix fixedpoint (void) const;
FixedComplexMatrix chdecsize (const Complex n);
FixedComplexMatrix chdecsize (const ComplexMatrix &n);
FixedComplexMatrix chintsize (const Complex n);
FixedComplexMatrix chintsize (const ComplexMatrix &n);
FixedComplexMatrix incdecsize (const Complex n);
FixedComplexMatrix incdecsize (const ComplexMatrix &n);
FixedComplexMatrix incdecsize ();
FixedComplexMatrix incintsize (const Complex n);
FixedComplexMatrix incintsize (const ComplexMatrix &n);
FixedComplexMatrix incintsize ();
FixedComplexMatrix& operator = (const FixedComplexMatrix& a)
{
MArray<FixedPointComplex>::operator = (a);
return *this;
}
bool operator == (const FixedComplexMatrix& a) const;
bool operator != (const FixedComplexMatrix& a) const;
bool is_hermitian (void) const;
bool is_symmetric (void) const;
FixedComplexMatrix concat (const FixedComplexMatrix& rb,
const Array<int>& ra_idx);
FixedComplexMatrix concat (const FixedMatrix& rb,
const Array<int>& ra_idx);
// destructive insert/delete/reorder operations
FixedComplexMatrix& insert (const FixedComplexMatrix& a, int r, int c);
FixedComplexMatrix& insert (const FixedComplexRowVector& a, int r, int c);
FixedComplexMatrix& insert (const FixedComplexColumnVector& a, int r, int c);
FixedComplexMatrix& fill (FixedPointComplex val);
FixedComplexMatrix& fill (FixedPointComplex val, int r1, int c1, int r2, int c2);
FixedComplexMatrix append (const FixedComplexMatrix& a) const;
FixedComplexMatrix append (const FixedComplexRowVector& a) const;
FixedComplexMatrix append (const FixedComplexColumnVector& a) const;
FixedComplexMatrix stack (const FixedComplexMatrix& a) const;
FixedComplexMatrix stack (const FixedComplexRowVector& a) const;
FixedComplexMatrix stack (const FixedComplexColumnVector& a) const;
FixedComplexMatrix hermitian (void) const;
FixedComplexMatrix transpose (void) const { return MArray<FixedPointComplex>::transpose (); }
// resize is the destructive equivalent for this one
FixedComplexMatrix extract (int r1, int c1, int r2, int c2) const;
FixedComplexMatrix extract_n (int r1, int c1, int nr, int nc) const;
// extract row or column i.
FixedComplexRowVector row (int i) const;
FixedComplexRowVector row (char *s) const;
FixedComplexColumnVector column (int i) const;
FixedComplexColumnVector column (char *s) const;
// unary operations
FixedComplexMatrix operator ! (void) const;
// other operations
FixedComplexMatrix map (fpc_fpc_Mapper f) const;
FixedComplexMatrix& apply (fpc_fpc_Mapper f);
bool all_elements_are_real (void) const;
boolMatrix all (int dim = -1) const;
boolMatrix any (int dim = -1) const;
FixedComplexMatrix cumprod (int dim = -1) const;
FixedComplexMatrix cumsum (int dim = -1) const;
FixedComplexMatrix prod (int dim = -1) const;
FixedComplexMatrix sum (int dim = -1) const;
FixedComplexMatrix sumsq (int dim = -1) const;
FixedComplexMatrix abs (void) const;
FixedComplexColumnVector diag (void) const;
FixedComplexColumnVector diag (int k) const;
FixedComplexColumnVector row_min (void) const;
FixedComplexColumnVector row_max (void) const;
FixedComplexColumnVector row_min (Array<int>& index) const;
FixedComplexColumnVector row_max (Array<int>& index) const;
FixedComplexRowVector column_min (void) const;
FixedComplexRowVector column_max (void) const;
FixedComplexRowVector column_min (Array<int>& index) const;
FixedComplexRowVector column_max (Array<int>& index) const;
friend OCTAVE_FIXED_API FixedComplexMatrix operator * (const FixedComplexColumnVector& a,
const FixedComplexRowVector& b);
friend OCTAVE_FIXED_API FixedComplexMatrix operator * (const FixedComplexMatrix& a,
const FixedComplexMatrix& b);
friend OCTAVE_FIXED_API FixedMatrix real (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedMatrix imag (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix conj (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedMatrix abs (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedMatrix norm (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedMatrix arg (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix polar (const FixedMatrix &r, const FixedMatrix &p);
friend OCTAVE_FIXED_API FixedComplexMatrix cos (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix cosh (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix sin (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix sinh (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix tan (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix tanh (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix sqrt (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix pow (const FixedComplexMatrix &a, const int b);
friend OCTAVE_FIXED_API FixedComplexMatrix pow (const FixedComplexMatrix &a, const double b);
friend OCTAVE_FIXED_API FixedComplexMatrix pow (const FixedComplexMatrix &a,
const FixedPointComplex &b);
friend OCTAVE_FIXED_API FixedComplexMatrix pow (const FixedComplexMatrix &a,
const FixedComplexMatrix &b);
friend OCTAVE_FIXED_API FixedComplexMatrix exp (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix log (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix log10 (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix round (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix rint (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix floor (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API FixedComplexMatrix ceil (const FixedComplexMatrix &x);
friend OCTAVE_FIXED_API ComplexMatrix fixedpoint (const FixedComplexMatrix& x);
friend OCTAVE_FIXED_API ComplexMatrix sign (const FixedComplexMatrix& x);
friend OCTAVE_FIXED_API ComplexMatrix getintsize (const FixedComplexMatrix& x);
friend OCTAVE_FIXED_API ComplexMatrix getdecsize (const FixedComplexMatrix& x);
friend OCTAVE_FIXED_API ComplexMatrix getnumber (const FixedComplexMatrix& x);
// i/o
friend OCTAVE_FIXED_API std::ostream& operator << (std::ostream& os,
const FixedComplexMatrix& a);
friend OCTAVE_FIXED_API std::istream& operator >> (std::istream& is, FixedComplexMatrix& a);
static FixedPointComplex resize_fill_value (void)
{ return FixedPointComplex(); }
};
OCTAVE_FIXED_API FixedComplexMatrix operator * (const FixedComplexColumnVector& a,
const FixedComplexRowVector& b);
OCTAVE_FIXED_API FixedComplexMatrix operator * (const FixedComplexMatrix& a,
const FixedComplexMatrix& b);
OCTAVE_FIXED_API FixedMatrix real (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedMatrix imag (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix conj (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedMatrix abs (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedMatrix norm (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedMatrix arg (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix polar (const FixedMatrix &r, const FixedMatrix &p);
OCTAVE_FIXED_API FixedComplexMatrix cos (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix cosh (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix sin (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix sinh (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix tan (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix tanh (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix sqrt (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix pow (const FixedComplexMatrix &a, const int b);
OCTAVE_FIXED_API FixedComplexMatrix pow (const FixedComplexMatrix &a, const double b);
OCTAVE_FIXED_API FixedComplexMatrix pow (const FixedComplexMatrix &a,
const FixedPointComplex &b);
OCTAVE_FIXED_API FixedComplexMatrix pow (const FixedComplexMatrix &a,
const FixedComplexMatrix &b);
OCTAVE_FIXED_API FixedComplexMatrix exp (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix log (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix log10 (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix round (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix rint (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix floor (const FixedComplexMatrix &x);
OCTAVE_FIXED_API FixedComplexMatrix ceil (const FixedComplexMatrix &x);
inline ComplexMatrix fixedpoint (const FixedComplexMatrix& x)
{ return x.fixedpoint(); }
inline ComplexMatrix sign (const FixedComplexMatrix& x)
{ return x.sign(); }
inline ComplexMatrix getintsize (const FixedComplexMatrix& x)
{ return x.getintsize(); }
inline ComplexMatrix getdecsize (const FixedComplexMatrix& x)
{ return x.getdecsize(); }
inline ComplexMatrix getnumber (const FixedComplexMatrix& x)
{ return x.getnumber(); }
OCTAVE_FIXED_API std::ostream& operator << (std::ostream& os,
const FixedComplexMatrix& a);
OCTAVE_FIXED_API std::istream& operator >> (std::istream& is, FixedComplexMatrix& a);
OCTAVE_FIXED_API FixedComplexMatrix min (FixedPointComplex d,
const FixedComplexMatrix& m);
OCTAVE_FIXED_API FixedComplexMatrix min (const FixedComplexMatrix& m,
FixedPointComplex d);
OCTAVE_FIXED_API FixedComplexMatrix min (const FixedComplexMatrix& a,
const FixedComplexMatrix& b);
OCTAVE_FIXED_API FixedComplexMatrix max (FixedPointComplex d,
const FixedComplexMatrix& m);
OCTAVE_FIXED_API FixedComplexMatrix max (const FixedComplexMatrix& m,
FixedPointComplex d);
OCTAVE_FIXED_API FixedComplexMatrix max (const FixedComplexMatrix& a,
const FixedComplexMatrix& b);
OCTAVE_FIXED_API FixedComplexMatrix elem_pow (const FixedComplexMatrix &a,
const FixedComplexMatrix &b);
OCTAVE_FIXED_API FixedComplexMatrix elem_pow (const FixedComplexMatrix &a,
const FixedPointComplex &b);
OCTAVE_FIXED_API FixedComplexMatrix elem_pow (const FixedPointComplex &a,
const FixedComplexMatrix &b);
MS_CMP_OP_DECLS (FixedComplexMatrix, FixedPointComplex, )
MS_BOOL_OP_DECLS (FixedComplexMatrix, FixedPointComplex, )
SM_CMP_OP_DECLS (FixedPointComplex, FixedComplexMatrix, )
SM_BOOL_OP_DECLS (FixedPointComplex, FixedComplexMatrix, )
MM_CMP_OP_DECLS (FixedComplexMatrix, FixedComplexMatrix, )
MM_BOOL_OP_DECLS (FixedComplexMatrix, FixedComplexMatrix, )
MARRAY_FORWARD_DEFS (MArray, FixedComplexMatrix, FixedPointComplex)
#endif
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/