annotate main/fixed/src/fixedCMatrix.cc @ 4404:2de537641f94 octave-forge

More copyright updates
author adb014
date Mon, 04 Feb 2008 13:47:45 +0000
parents 17e102866239
children f8d77845533f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1 /*
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
2
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
3 Copyright (C) 2003 Motorola Inc
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
4 Copyright (C) 2003 David Bateman
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
5
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
6 This program is free software; you can redistribute it and/or modify it
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
9 later version.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
10
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
11 This program is distributed in the hope that it will be useful, but WITHOUT
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
14 for more details.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
15
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
4404
2de537641f94 More copyright updates
adb014
parents: 3272
diff changeset
17 along with this program; see the file COPYING. If not, see
2de537641f94 More copyright updates
adb014
parents: 3272
diff changeset
18 <http://www.gnu.org/licenses/>.
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
19
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
20 In addition to the terms of the GPL, you are permitted to link
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
21 this program with any Open Source program, as defined by the
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
22 Open Source Initiative (www.opensource.org)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
23
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
24 */
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
25
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
26 #include <iostream>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
27
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
28 #include <octave/config.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
29 #include <octave/lo-error.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
30 #include <octave/lo-utils.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
31 #include <octave/lo-error.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
32 #include <octave/error.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
33 #include <octave/dMatrix.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
34 #include <octave/gripes.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
35 #include <octave/ops.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
36 #include <octave/quit.h>
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
37
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
38 #include "fixedColVector.h"
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
39 #include "fixedRowVector.h"
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
40 #include "fixedMatrix.h"
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
41 #include "fixedCColVector.h"
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
42 #include "fixedCRowVector.h"
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
43 #include "fixedCMatrix.h"
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
44
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
45 // Fixed Point Complex Matrix class.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
46
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
47 FixedComplexMatrix::FixedComplexMatrix (const MArray2<int> &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
48 const MArray2<int> &ds)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
49 : MArray2<FixedPointComplex> (is.rows(), is.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
50 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
51 if ((rows() != ds.rows()) || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
52 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
53 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
54 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
55
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
56 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
57 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
58 elem (i, j) = FixedPointComplex((unsigned int)is(i,j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
59 (unsigned int)ds(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
60 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
61
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
62 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
63 : MArray2<FixedPointComplex> (is.rows(), is.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
64 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
65 if ((rows() != ds.rows()) || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
66 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
67 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
68 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
69
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
70 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
71 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
72 elem (i, j) = FixedPointComplex((unsigned int)is(i,j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
73 (unsigned int)ds(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
74 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
75
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
76 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
77 const ComplexMatrix &ds)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
78 : MArray2<FixedPointComplex> (is.rows(), is.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
79 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
80 if ((rows() != ds.rows()) || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
81 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
82 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
83 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
84
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
85 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
86 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
87 elem (i, j) = FixedPointComplex( is(i,j), ds(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
88 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
89
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
90 FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
91 const FixedComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
92 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
93 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
94 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
95 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
96 elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
97 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
98
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
99 FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
100 const FixedComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
101 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
102 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
103 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
104 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
105 elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
106 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
107
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
108 FixedComplexMatrix::FixedComplexMatrix (const MArray2<int> &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
109 const MArray2<int> &ds, const FixedComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
110 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
111 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
112 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
113 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
114 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
115 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
116 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
117
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
118 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
119 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
120 elem (i, j) = FixedPointComplex((unsigned int)is(i,j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
121 (unsigned int)ds(i,j), a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
122 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
123
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
124 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
125 const FixedComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
126 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
127 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
128 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
129 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
130 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
131 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
132 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
133
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
134 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
135 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
136 elem (i, j) = FixedPointComplex((unsigned int)is(i,j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
137 (unsigned int)ds(i,j), a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
138 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
139
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
140 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
141 const ComplexMatrix &ds, const FixedComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
142 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
143 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
144 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
145 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
146 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
147 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
148 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
149
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
150 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
151 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
152 elem (i, j) = FixedPointComplex( is(i,j), ds(i,j), a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
153 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
154
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
155 FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
156 const FixedMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
157 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
158 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
159 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
160 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
161 elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
162 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
163
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
164 FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
165 const FixedMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
166 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
167 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
168 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
169 for (int i = 0; i < rows (); i++)
3071
fa041e4681b4 Fix MSVC compilation.
goffioul
parents: 2914
diff changeset
170 elem (i, j) = FixedPointComplex(is, ds, FixedPointComplex(a.elem (i, j)));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
171 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
172
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
173 FixedComplexMatrix::FixedComplexMatrix (const MArray2<int> &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
174 const MArray2<int> &ds, const FixedMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
175 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
176 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
177 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
178 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
179 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
180 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
181 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
182
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
183 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
184 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
185 elem (i, j) = FixedPointComplex((unsigned int)is(i,j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
186 (unsigned int)ds(i,j), a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
187 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
188
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
189 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
190 const FixedMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
191 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
192 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
193 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
194 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
195 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
196 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
197 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
198
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
199 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
200 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
201 elem (i, j) = FixedPointComplex((unsigned int)is(i,j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
202 (unsigned int)ds(i,j), a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
203 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
204
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
205 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
206 const ComplexMatrix &ds, const FixedMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
207 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
208 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
209 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
210 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
211 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
212 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
213 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
214
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
215 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
216 for (int i = 0; i < rows (); i++)
3071
fa041e4681b4 Fix MSVC compilation.
goffioul
parents: 2914
diff changeset
217 elem (i, j) = FixedPointComplex( is(i,j), ds(i,j), FixedPointComplex(a.elem (i, j)));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
218 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
219
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
220 FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
221 const ComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
222 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
223 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
224 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
225 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
226 elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
227 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
228
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
229 FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
230 const ComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
231 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
232 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
233 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
234 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
235 elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
236 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
237
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
238 FixedComplexMatrix::FixedComplexMatrix (const MArray2<int> &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
239 const MArray2<int> &ds, const ComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
240 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
241 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
242 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
243 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
244 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
245 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
246 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
247
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
248 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
249 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
250 elem (i, j) = FixedPointComplex((unsigned int)is(i,j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
251 (unsigned int)ds(i,j), a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
252 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
253
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
254 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
255 const ComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
256 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
257 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
258 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
259 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
260 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
261 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
262 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
263
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
264 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
265 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
266 elem (i, j) = FixedPointComplex((unsigned int)is(i,j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
267 (unsigned int)ds(i,j), a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
268 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
269
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
270 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
271 const ComplexMatrix &ds, const ComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
272 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
273 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
274 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
275 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
276 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
277 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
278 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
279
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
280 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
281 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
282 elem (i, j) = FixedPointComplex(is(i,j), ds(i,j), a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
283 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
284
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
285 FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
286 const Matrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
287 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
288 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
289 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
290 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
291 elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
292 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
293
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
294 FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
295 const Matrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
296 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
297 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
298 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
299 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
300 elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
301 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
302
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
303 FixedComplexMatrix::FixedComplexMatrix (const MArray2<int> &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
304 const MArray2<int> &ds, const Matrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
305 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
306 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
307 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
308 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
309 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
310 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
311 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
312
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
313 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
314 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
315 elem (i, j) = FixedPointComplex((unsigned int)is(i,j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
316 (unsigned int)ds(i,j), a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
317 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
318
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
319 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
320 const Matrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
321 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
322 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
323 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
324 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
325 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
326 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
327 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
328
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
329 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
330 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
331 elem (i, j) = FixedPointComplex((unsigned int)is(i,j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
332 (unsigned int)ds(i,j), a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
333 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
334
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
335 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
336 const ComplexMatrix &ds, const Matrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
337 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
338 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
339 if ((rows() != is.rows()) || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
340 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
341 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
342 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
343 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
344
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
345 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
346 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
347 elem (i, j) = FixedPointComplex(is(i,j), ds(i,j), a.elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
348 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
349
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
350
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
351 FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
352 const ComplexMatrix& a, const ComplexMatrix& b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
353 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
354 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
355 if ((rows() != b.rows()) || (cols() != b.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
356 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
357 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
358 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
359
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
360 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
361 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
362 elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j), b.elem(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
363 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
364
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
365 FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
366 const ComplexMatrix& a, const ComplexMatrix& b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
367 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
368 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
369 if ((rows() != b.rows()) || (cols() != b.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
370 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
371 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
372 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
373
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
374 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
375 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
376 elem (i, j) = FixedPointComplex(is, ds, a.elem (i, j), b.elem(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
377 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
378
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
379 FixedComplexMatrix::FixedComplexMatrix (const MArray2<int> &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
380 const MArray2<int> &ds, const ComplexMatrix& a,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
381 const ComplexMatrix& b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
382 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
383 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
384 if ((rows() != b.rows()) || (cols() != b.cols()) || (rows() != is.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
385 || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
386 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
387 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
388 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
389 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
390
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
391 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
392 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
393 elem (i, j) = FixedPointComplex(is(i, j), ds(i, j), a.elem (i, j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
394 b.elem(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
395 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
396
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
397 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
398 const ComplexMatrix& a, const ComplexMatrix& b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
399 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
400 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
401 if ((rows() != b.rows()) || (cols() != b.cols()) || (rows() != is.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
402 || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
403 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
404 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
405 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
406 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
407
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
408 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
409 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
410 elem (i, j) = FixedPointComplex((unsigned int)is(i, j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
411 (unsigned int)ds(i, j), a.elem (i, j), b.elem(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
412 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
413
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
414 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
415 const ComplexMatrix &ds, const ComplexMatrix& a,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
416 const ComplexMatrix& b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
417 : MArray2<FixedPointComplex> (a.rows(), a.cols())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
418 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
419 if ((rows() != b.rows()) || (cols() != b.cols()) || (rows() != is.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
420 || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
421 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
422 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
423 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
424 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
425
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
426 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
427 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
428 elem (i, j) = FixedPointComplex(is(i, j), ds(i, j), a.elem (i, j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
429 b.elem(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
430 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
431
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
432 FixedComplexMatrix::FixedComplexMatrix (const FixedComplexRowVector& rv)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
433 : MArray2<FixedPointComplex> (1, rv.length (), FixedPointComplex())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
434 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
435 for (int i = 0; i < rv.length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
436 elem (0, i) = rv.elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
437 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
438
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
439 FixedComplexMatrix::FixedComplexMatrix (const FixedRowVector& rv)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
440 : MArray2<FixedPointComplex> (1, rv.length (), FixedPointComplex())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
441 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
442 for (int i = 0; i < rv.length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
443 elem (0, i) = FixedPointComplex(rv.elem (i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
444 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
445
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
446 FixedComplexMatrix::FixedComplexMatrix (const FixedComplexColumnVector& cv)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
447 : MArray2<FixedPointComplex> (cv.length (), 1, FixedPointComplex())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
448 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
449 for (int i = 0; i < cv.length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
450 elem (i, 0) = cv.elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
451 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
452
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
453 FixedComplexMatrix::FixedComplexMatrix (const FixedColumnVector& cv)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
454 : MArray2<FixedPointComplex> (cv.length (), 1, FixedPointComplex())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
455 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
456 for (int i = 0; i < cv.length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
457 elem (i, 0) = FixedPointComplex(cv.elem (i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
458 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
459
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
460 FixedComplexMatrix::FixedComplexMatrix (const FixedMatrix& m)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
461 : MArray2<FixedPointComplex> (m.rows (), m.cols (), FixedPointComplex())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
462 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
463 for (int j = 0; j < m.cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
464 for (int i = 0; i < m.rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
465 elem (i, j) = FixedPointComplex(m.elem (i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
466 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
467
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
468 FixedComplexMatrix::FixedComplexMatrix (const FixedMatrix& a,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
469 const FixedMatrix& b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
470 : MArray2<FixedPointComplex> (a.rows (), a.cols (), FixedPointComplex())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
471 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
472 if ((rows() != b.rows()) || (cols() != b.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
473 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
474 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
475 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
476 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
477 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
478 elem (i, j) = FixedPointComplex(a.elem (i,j), b.elem (i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
479 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
480
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
481 #define GET_FIXED_PROP(METHOD) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
482 ComplexMatrix \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
483 FixedComplexMatrix:: METHOD (void) const \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
484 { \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
485 int nr = rows(); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
486 int nc = cols(); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
487 ComplexMatrix retval(nr,nc); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
488 for (int i = 0; i < nr; i++) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
489 for (int j = 0; j < nc; j++) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
490 retval(i,j) = elem(i,j) . METHOD (); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
491 return retval; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
492 } \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
493
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
494 GET_FIXED_PROP(sign);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
495 GET_FIXED_PROP(getdecsize);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
496 GET_FIXED_PROP(getintsize);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
497 GET_FIXED_PROP(getnumber);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
498 GET_FIXED_PROP(fixedpoint);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
499
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
500 #undef GET_FIXED_PROP
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
501
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
502 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
503 FixedComplexMatrix::chdecsize (const Complex n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
504 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
505 int nr = rows();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
506 int nc = cols();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
507 FixedComplexMatrix retval(nr,nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
508
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
509 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
510 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
511 retval(i,j) = FixedPointComplex(elem(i,j).getintsize(), n, elem(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
512
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
513 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
514 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
515
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
516 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
517 FixedComplexMatrix::chdecsize (const ComplexMatrix &n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
518 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
519 int nr = rows();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
520 int nc = cols();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
521
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
522 if ((nr != n.rows()) || (nc != n.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
523 (*current_liboctave_error_handler) ("matrix size mismatch in chdecsize");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
524 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
525 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
526
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
527 FixedComplexMatrix retval(nr,nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
528
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
529 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
530 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
531 retval(i,j) = FixedPointComplex(elem(i,j).getintsize(), n(i,j),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
532 elem(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
533
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
534 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
535 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
536
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
537 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
538 FixedComplexMatrix::chintsize (const Complex n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
539 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
540 int nr = rows();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
541 int nc = cols();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
542 FixedComplexMatrix retval(nr,nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
543
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
544 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
545 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
546 retval(i,j) = FixedPointComplex(n, elem(i,j).getdecsize(), elem(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
547
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
548 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
549 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
550
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
551 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
552 FixedComplexMatrix::chintsize (const ComplexMatrix &n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
553 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
554 int nr = rows();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
555 int nc = cols();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
556
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
557 if ((nr != n.rows()) || (nc != n.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
558 (*current_liboctave_error_handler) ("matrix size mismatch in chintsize");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
559 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
560 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
561
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
562 FixedComplexMatrix retval(nr,nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
563
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
564 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
565 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
566 retval(i,j) = FixedPointComplex(n(i,j), elem(i,j).getdecsize(),
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
567 elem(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
568
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
569 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
570 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
571
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
572 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
573 FixedComplexMatrix::incdecsize (const Complex n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
574 return chdecsize(n + getdecsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
575 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
576
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
577 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
578 FixedComplexMatrix::incdecsize (const ComplexMatrix &n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
579 if ((n.rows() != rows()) || (n.cols() != cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
580 (*current_liboctave_error_handler) ("matrix size mismatch in chintsize");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
581 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
582 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
583 return chdecsize(n + getdecsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
584 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
585
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
586 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
587 FixedComplexMatrix::incdecsize () {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
588 return chdecsize(Complex(1,1) + getdecsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
589 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
590
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
591 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
592 FixedComplexMatrix::incintsize (const Complex n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
593 return chintsize(n + getintsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
594 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
595
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
596 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
597 FixedComplexMatrix::incintsize (const ComplexMatrix &n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
598 if ((n.rows() != rows()) || (n.cols() != cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
599 (*current_liboctave_error_handler) ("matrix size mismatch in chintsize");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
600 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
601 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
602 return chintsize(n + getintsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
603 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
604
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
605 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
606 FixedComplexMatrix::incintsize () {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
607 return chintsize(Complex(1,1) + getintsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
608 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
609
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
610 bool
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
611 FixedComplexMatrix::operator == (const FixedComplexMatrix& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
612 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
613 if (rows () != a.rows () || cols () != a.cols ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
614 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
615
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
616 for (int i = 0; i < rows(); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
617 for (int j = 0; j < cols(); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
618 if (elem(i,j) != a.elem(i,j))
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
619 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
620 return true;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
621 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
622
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
623 bool
2914
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
624 FixedComplexMatrix::operator != (const FixedComplexMatrix& a) const
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
625 {
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
626 return !(*this == a);
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
627 }
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
628
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
629 bool
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
630 FixedComplexMatrix::is_symmetric (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
631 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
632 if (is_square () && rows () > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
633 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
634 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
635 for (int j = i+1; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
636 if (elem (i, j) != elem (j, i))
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
637 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
638
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
639 return true;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
640 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
641
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
642 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
643 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
644
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
645 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
646 FixedComplexMatrix::concat (const FixedComplexMatrix& rb,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
647 const Array<int>& ra_idx)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
648 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
649 if (rb.numel() > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
650 insert (rb, ra_idx(0), ra_idx(1));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
651 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
652 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
653
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
654 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
655 FixedComplexMatrix::concat (const FixedMatrix& rb,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
656 const Array<int>& ra_idx)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
657 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
658 if (rb.numel() > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
659 insert (FixedComplexMatrix (rb), ra_idx(0), ra_idx(1));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
660 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
661 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
662
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
663 FixedComplexMatrix&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
664 FixedComplexMatrix::insert (const FixedComplexMatrix& a, int r, int c)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
665 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
666 Array2<FixedPointComplex>::insert (a, r, c);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
667 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
668 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
669
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
670 FixedComplexMatrix&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
671 FixedComplexMatrix::insert (const FixedComplexRowVector& a, int r, int c)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
672 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
673 int a_len = a.length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
674
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
675 if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
676 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
677 (*current_liboctave_error_handler) ("range error for insert");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
678 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
679 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
680
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
681 if (a_len > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
682 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
683 make_unique ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
684
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
685 for (int i = 0; i < a_len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
686 xelem (r, c+i) = a.elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
687 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
688
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
689 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
690 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
691
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
692 FixedComplexMatrix&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
693 FixedComplexMatrix::insert (const FixedComplexColumnVector& a, int r, int c)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
694 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
695 int a_len = a.length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
696
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
697 if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
698 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
699 (*current_liboctave_error_handler) ("range error for insert");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
700 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
701 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
702
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
703 if (a_len > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
704 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
705 make_unique ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
706
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
707 for (int i = 0; i < a_len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
708 xelem (r+i, c) = a.elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
709 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
710
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
711 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
712 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
713
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
714 FixedComplexMatrix&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
715 FixedComplexMatrix::fill (FixedPointComplex val)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
716 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
717 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
718 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
719
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
720 if (nr > 0 && nc > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
721 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
722 make_unique ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
723
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
724 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
725 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
726 xelem (i, j) = val;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
727 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
728
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
729 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
730 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
731
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
732 FixedComplexMatrix&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
733 FixedComplexMatrix::fill (FixedPointComplex val, int r1, int c1, int r2, int c2)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
734 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
735 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
736 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
737
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
738 if (r1 < 0 || r2 < 0 || c1 < 0 || c2 < 0
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
739 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
740 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
741 (*current_liboctave_error_handler) ("range error for fill");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
742 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
743 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
744
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
745 if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
746 if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
747
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
748 if (r2 >= r1 && c2 >= c1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
749 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
750 make_unique ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
751
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
752 for (int j = c1; j <= c2; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
753 for (int i = r1; i <= r2; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
754 xelem (i, j) = val;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
755 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
756
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
757 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
758 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
759
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
760 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
761 FixedComplexMatrix::append (const FixedComplexMatrix& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
762 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
763 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
764 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
765 if (nr != a.rows ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
766 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
767 (*current_liboctave_error_handler) ("row dimension mismatch for append");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
768 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
769 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
770
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
771 int nc_insert = nc;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
772 FixedComplexMatrix retval (nr, nc + a.cols ());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
773 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
774 retval.insert (a, 0, nc_insert);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
775 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
776 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
777
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
778 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
779 FixedComplexMatrix::append (const FixedComplexRowVector& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
780 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
781 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
782 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
783 if (nr != 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
784 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
785 (*current_liboctave_error_handler) ("row dimension mismatch for append");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
786 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
787 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
788
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
789 int nc_insert = nc;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
790 FixedComplexMatrix retval (nr, nc + a.length ());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
791 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
792 retval.insert (a, 0, nc_insert);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
793 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
794 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
795
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
796 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
797 FixedComplexMatrix::append (const FixedComplexColumnVector& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
798 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
799 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
800 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
801 if (nr != a.length ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
802 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
803 (*current_liboctave_error_handler) ("row dimension mismatch for append");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
804 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
805 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
806
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
807 int nc_insert = nc;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
808 FixedComplexMatrix retval (nr, nc + 1);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
809 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
810 retval.insert (a, 0, nc_insert);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
811 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
812 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
813
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
814 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
815 FixedComplexMatrix::stack (const FixedComplexMatrix& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
816 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
817 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
818 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
819 if (nc != a.cols ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
820 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
821 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
822 ("column dimension mismatch for stack");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
823 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
824 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
825
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
826 int nr_insert = nr;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
827 FixedComplexMatrix retval (nr + a.rows (), nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
828 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
829 retval.insert (a, nr_insert, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
830 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
831 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
832
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
833 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
834 FixedComplexMatrix::stack (const FixedComplexRowVector& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
835 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
836 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
837 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
838 if (nc != a.length ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
839 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
840 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
841 ("column dimension mismatch for stack");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
842 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
843 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
844
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
845 int nr_insert = nr;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
846 FixedComplexMatrix retval (nr + 1, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
847 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
848 retval.insert (a, nr_insert, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
849 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
850 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
851
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
852 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
853 FixedComplexMatrix::stack (const FixedComplexColumnVector& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
854 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
855 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
856 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
857 if (nc != 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
858 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
859 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
860 ("column dimension mismatch for stack");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
861 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
862 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
863
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
864 int nr_insert = nr;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
865 FixedComplexMatrix retval (nr + a.length (), nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
866 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
867 retval.insert (a, nr_insert, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
868 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
869 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
870
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
871 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
872 FixedComplexMatrix::extract (int r1, int c1, int r2, int c2) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
873 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
874 if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
875 if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
876
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
877 int new_r = r2 - r1 + 1;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
878 int new_c = c2 - c1 + 1;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
879
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
880 FixedComplexMatrix result (new_r, new_c);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
881
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
882 for (int j = 0; j < new_c; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
883 for (int i = 0; i < new_r; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
884 result.xelem (i, j) = elem (r1+i, c1+j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
885
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
886 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
887 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
888
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
889 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
890 FixedComplexMatrix::extract_n (int r1, int c1, int nr, int nc) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
891 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
892 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
893
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
894 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
895 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
896 result.xelem (i, j) = elem (r1+i, c1+j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
897
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
898 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
899 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
900
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
901 // extract row or column i.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
902
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
903 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
904 FixedComplexMatrix::row (int i) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
905 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
906 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
907 if (i < 0 || i >= rows ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
908 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
909 (*current_liboctave_error_handler) ("invalid row selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
910 return FixedComplexRowVector ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
911 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
912
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
913 FixedComplexRowVector retval (nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
914 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
915 retval.xelem (j) = elem (i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
916
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
917 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
918 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
919
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
920 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
921 FixedComplexMatrix::row (char *s) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
922 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
923 if (! s)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
924 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
925 (*current_liboctave_error_handler) ("invalid row selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
926 return FixedComplexRowVector ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
927 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
928
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
929 char c = *s;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
930 if (c == 'f' || c == 'F')
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
931 return row (0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
932 else if (c == 'l' || c == 'L')
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
933 return row (rows () - 1);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
934 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
935 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
936 (*current_liboctave_error_handler) ("invalid row selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
937 return FixedComplexRowVector ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
938 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
939 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
940
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
941 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
942 FixedComplexMatrix::column (int i) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
943 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
944 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
945 if (i < 0 || i >= cols ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
946 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
947 (*current_liboctave_error_handler) ("invalid column selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
948 return FixedComplexColumnVector ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
949 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
950
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
951 FixedComplexColumnVector retval (nr);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
952 for (int j = 0; j < nr; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
953 retval.xelem (j) = elem (j, i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
954
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
955 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
956 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
957
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
958 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
959 FixedComplexMatrix::column (char *s) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
960 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
961 if (! s)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
962 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
963 (*current_liboctave_error_handler) ("invalid column selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
964 return FixedComplexColumnVector ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
965 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
966
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
967 char c = *s;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
968 if (c == 'f' || c == 'F')
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
969 return column (0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
970 else if (c == 'l' || c == 'L')
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
971 return column (cols () - 1);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
972 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
973 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
974 (*current_liboctave_error_handler) ("invalid column selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
975 return FixedComplexColumnVector ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
976 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
977 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
978
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
979 // unary operations
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
980
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
981 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
982 FixedComplexMatrix::operator ! (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
983 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
984 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
985 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
986
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
987 FixedComplexMatrix b (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
988
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
989 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
990 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
991 b.elem (i, j) = ! elem (i, j) ;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
992
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
993 return b;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
994 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
995
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
996 // column vector by row vector -> matrix operations
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
997
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
998 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
999 operator * (const FixedComplexColumnVector& v, const FixedComplexRowVector& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1000 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1001 FixedComplexMatrix retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1002
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1003 int len = v.length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1004
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1005 if (len != 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1006 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1007 int a_len = a.length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1008
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1009 retval.resize (len, a_len);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1010
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1011 for (int i = 0; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1012 for (int j = 0; j < a_len; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1013 retval.elem(j,i) = v.elem(i) * a.elem(j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1014 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1015
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1016 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1017 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1018
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1019 // other operations.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1020
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1021 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1022 FixedComplexMatrix::map (fc_fc_Mapper f) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1023 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1024 FixedComplexMatrix b (*this);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1025 return b.apply (f);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1026 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1027
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1028 FixedComplexMatrix&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1029 FixedComplexMatrix::apply (fc_fc_Mapper f)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1030 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1031 FixedPointComplex *d = fortran_vec (); // Ensures only one reference to my privates!
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1032
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1033 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1034 d[i] = f (d[i]);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1035
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1036 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1037 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1038
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1039 boolMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1040 FixedComplexMatrix::all (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1041 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1042 #define ROW_EXPR \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1043 if (elem (i, j) .fixedpoint () == 0.0) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1044 { \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1045 retval.elem (i, 0) = false; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1046 break; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1047 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1048 #define COL_EXPR \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1049 if (elem (i, j) .fixedpoint () == 0.0) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1050 { \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1051 retval.elem (0, j) = false; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1052 break; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1053 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1054
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1055 MX_BASE_REDUCTION_OP (boolMatrix, ROW_EXPR, COL_EXPR, true, true);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1056
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1057 #undef ROW_EXPR
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1058 #undef COL_EXPR
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1059 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1060
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1061 boolMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1062 FixedComplexMatrix::any (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1063 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1064 #define ROW_EXPR \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1065 if (elem (i, j) .fixedpoint () != 0.0) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1066 { \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1067 retval.elem (i, 0) = true; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1068 break; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1069 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1070 #define COL_EXPR \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1071 if (elem (i, j) .fixedpoint () != 0.0) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1072 { \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1073 retval.elem (0, j) = true; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1074 break; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1075 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1076
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1077 MX_BASE_REDUCTION_OP (boolMatrix, ROW_EXPR, COL_EXPR, false, false);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1078
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1079 #undef ROW_EXPR
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1080 #undef COL_EXPR
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1081 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1082
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1083 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1084 FixedComplexMatrix::cumprod (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1085 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1086 MX_CUMULATIVE_OP (FixedComplexMatrix, FixedPointComplex, *=);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1087 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1088
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1089 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1090 FixedComplexMatrix::cumsum (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1091 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1092 MX_CUMULATIVE_OP (FixedComplexMatrix, FixedPointComplex, +=);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1093 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1094
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1095 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1096 FixedComplexMatrix::prod (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1097 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1098 FixedPointComplex one(1, 0, 1, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1099 MX_REDUCTION_OP (FixedComplexMatrix, *=, one, one);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1100 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1101
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1102 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1103 FixedComplexMatrix::sum (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1104 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1105 FixedPointComplex zero;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1106 MX_REDUCTION_OP (FixedComplexMatrix, +=, zero, zero);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1107 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1108
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1109 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1110 FixedComplexMatrix::sumsq (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1111 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1112 FixedPointComplex zero;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1113 #define ROW_EXPR \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1114 FixedPointComplex d = elem (i, j); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1115 retval.elem (i, 0) += d * conj(d)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1116
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1117 #define COL_EXPR \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1118 FixedPointComplex d = elem (i, j); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1119 retval.elem (0, j) += d * conj(d)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1120
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1121 MX_BASE_REDUCTION_OP (FixedComplexMatrix, ROW_EXPR, COL_EXPR, zero, zero);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1122
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1123 #undef ROW_EXPR
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1124 #undef COL_EXPR
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1125 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1126
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1127 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1128 FixedComplexMatrix::abs (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1129 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1130 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1131 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1132
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1133 FixedComplexMatrix retval (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1134
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1135 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1136 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1137 retval (i, j) = ::abs(elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1138
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1139 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1140 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1141
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1142 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1143 FixedComplexMatrix::diag (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1144 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1145 return diag (0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1146 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1147
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1148 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1149 FixedComplexMatrix::diag (int k) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1150 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1151 int nnr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1152 int nnc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1153 if (k > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1154 nnc -= k;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1155 else if (k < 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1156 nnr += k;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1157
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1158 FixedComplexColumnVector d;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1159
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1160 if (nnr > 0 && nnc > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1161 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1162 int ndiag = (nnr < nnc) ? nnr : nnc;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1163
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1164 d.resize (ndiag);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1165
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1166 if (k > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1167 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1168 for (int i = 0; i < ndiag; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1169 d.elem (i) = elem (i, i+k);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1170 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1171 else if ( k < 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1172 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1173 for (int i = 0; i < ndiag; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1174 d.elem (i) = elem (i-k, i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1175 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1176 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1177 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1178 for (int i = 0; i < ndiag; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1179 d.elem (i) = elem (i, i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1180 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1181 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1182 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1183 std::cerr << "diag: requested diagonal out of range\n";
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1184
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1185 return d;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1186 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1187
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1188 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1189 FixedComplexMatrix::row_min (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1190 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1191 Array<int> index;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1192 return row_min (index);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1193 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1194
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1195 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1196 FixedComplexMatrix::row_min (Array<int>& index) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1197 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1198 FixedComplexColumnVector result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1199
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1200 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1201 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1202
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1203 if (nr > 0 && nc > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1204 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1205 result.resize (nr);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1206 index.resize (nr);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1207
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1208 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1209 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1210 int idx_j = 0;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1211
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1212 FixedPointComplex tmp_min = elem (i, idx_j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1213 FixedPoint tmp_min_abs = ::abs(tmp_min);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1214
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1215 for (int j = 1; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1216 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1217 FixedPointComplex tmp = elem (i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1218 FixedPoint tmp_abs = ::abs(tmp);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1219 if (tmp_abs < tmp_min_abs)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1220 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1221 idx_j = j;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1222 tmp_min = tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1223 tmp_min_abs = tmp_abs;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1224 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1225 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1226
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1227 result.elem (i) = tmp_min;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1228 index.elem (i) = idx_j;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1229 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1230 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1231
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1232 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1233 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1234
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1235 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1236 FixedComplexMatrix::row_max (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1237 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1238 Array<int> index;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1239 return row_max (index);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1240 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1241
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1242 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1243 FixedComplexMatrix::row_max (Array<int>& index) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1244 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1245 FixedComplexColumnVector result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1246
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1247 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1248 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1249
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1250 if (nr > 0 && nc > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1251 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1252 result.resize (nr);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1253 index.resize (nr);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1254
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1255 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1256 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1257 int idx_j = 0;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1258
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1259 FixedPointComplex tmp_max = elem (i, idx_j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1260 FixedPoint tmp_max_abs = ::abs(tmp_max);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1261
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1262 for (int j = 1; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1263 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1264 FixedPointComplex tmp = elem (i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1265 FixedPoint tmp_abs = ::abs(tmp);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1266 if (tmp_abs > tmp_max_abs)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1267 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1268 idx_j = j;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1269 tmp_max = tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1270 tmp_max_abs = tmp_abs;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1271 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1272 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1273
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1274 result.elem (i) = tmp_max;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1275 index.elem (i) = idx_j;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1276 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1277 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1278
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1279 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1280 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1281
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1282 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1283 FixedComplexMatrix::column_min (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1284 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1285 Array<int> index;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1286 return column_min (index);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1287 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1288
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1289 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1290 FixedComplexMatrix::column_min (Array<int>& index) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1291 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1292 FixedComplexRowVector result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1293
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1294 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1295 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1296
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1297 if (nr > 0 && nc > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1298 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1299 result.resize (nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1300 index.resize (nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1301
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1302 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1303 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1304 int idx_i = 0;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1305
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1306 FixedPointComplex tmp_min = elem (idx_i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1307 FixedPoint tmp_min_abs = ::abs(tmp_min);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1308
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1309 for (int i = 1; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1310 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1311 FixedPointComplex tmp = elem (i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1312 FixedPoint tmp_abs = ::abs(tmp);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1313 if (tmp_abs < tmp_min_abs)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1314 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1315 idx_i = i;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1316 tmp_min = tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1317 tmp_min_abs = tmp_abs;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1318 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1319 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1320
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1321 result.elem (j) = tmp_min;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1322 index.elem (j) = idx_i;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1323 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1324 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1325
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1326 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1327 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1328
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1329 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1330 FixedComplexMatrix::column_max (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1331 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1332 Array<int> index;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1333 return column_max (index);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1334 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1335
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1336 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1337 FixedComplexMatrix::column_max (Array<int>& index) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1338 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1339 FixedComplexRowVector result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1340
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1341 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1342 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1343
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1344 if (nr > 0 && nc > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1345 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1346 result.resize (nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1347 index.resize (nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1348
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1349 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1350 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1351 int idx_i = 0;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1352
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1353 FixedPointComplex tmp_max = elem (idx_i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1354 FixedPoint tmp_max_abs = ::abs(tmp_max);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1355
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1356 for (int i = 1; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1357 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1358 FixedPointComplex tmp = elem (i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1359 FixedPoint tmp_abs = ::abs(tmp);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1360
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1361 if (tmp_abs > tmp_max_abs)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1362 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1363 idx_i = i;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1364 tmp_max = tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1365 tmp_max_abs = tmp_abs;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1366 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1367 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1368
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1369 result.elem (j) = tmp_max;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1370 index.elem (j) = idx_i;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1371 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1372 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1373
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1374 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1375 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1376
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1377 #define DO_FIXED_MAT_FUNC(FUNC, MT) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1378 MT FUNC (const FixedComplexMatrix& x) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1379 { \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1380 MT retval ( x.rows(), x.cols()); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1381 for (int j = 0; j < x.cols(); j++) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1382 for (int i = 0; i < x.rows(); i++) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1383 retval(i,j) = FUNC ( x (i,j) ); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1384 return retval; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1385 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1386
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1387 DO_FIXED_MAT_FUNC(real, FixedMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1388 DO_FIXED_MAT_FUNC(imag, FixedMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1389 DO_FIXED_MAT_FUNC(conj, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1390 DO_FIXED_MAT_FUNC(abs, FixedMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1391 DO_FIXED_MAT_FUNC(norm, FixedMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1392 DO_FIXED_MAT_FUNC(arg, FixedMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1393 DO_FIXED_MAT_FUNC(cos, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1394 DO_FIXED_MAT_FUNC(cosh, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1395 DO_FIXED_MAT_FUNC(sin, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1396 DO_FIXED_MAT_FUNC(sinh, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1397 DO_FIXED_MAT_FUNC(tan, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1398 DO_FIXED_MAT_FUNC(tanh, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1399 DO_FIXED_MAT_FUNC(sqrt, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1400 DO_FIXED_MAT_FUNC(exp, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1401 DO_FIXED_MAT_FUNC(log, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1402 DO_FIXED_MAT_FUNC(log10, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1403 DO_FIXED_MAT_FUNC(round, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1404 DO_FIXED_MAT_FUNC(rint, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1405 DO_FIXED_MAT_FUNC(floor, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1406 DO_FIXED_MAT_FUNC(ceil, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1407
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1408 FixedComplexMatrix polar (const FixedMatrix &r, const FixedMatrix &p)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1409 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1410 if ((r.rows() != p.rows()) || (r.cols() != p.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1411 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1412 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1413 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1414
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1415 FixedComplexMatrix retval ( r.rows(), r.cols());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1416 for (int j = 0; j < r.cols(); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1417 for (int i = 0; i < r.rows(); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1418 retval(i,j) = polar ( r (i,j), p (i,j) );
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1419 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1420 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1421
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1422 FixedComplexMatrix elem_pow (const FixedComplexMatrix &a, const FixedComplexMatrix &b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1423 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1424 FixedComplexMatrix retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1425 int a_nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1426 int a_nc = a.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1427 int b_nr = b.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1428 int b_nc = b.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1429
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1430 if (a_nr == 1 && a_nc == 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1431 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1432 retval.resize(b_nr,b_nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1433 FixedPointComplex ad = a(0,0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1434 for (int j = 0; j < b_nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1435 for (int i = 0; i < b_nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1436 retval(i,j) = pow(ad, b(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1437 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1438 else if (b_nr == 1 && b_nc == 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1439 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1440 retval.resize(a_nr,a_nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1441 FixedPointComplex bd = b(0,0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1442 for (int j = 0; j < a_nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1443 for (int i = 0; i < a_nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1444 retval(i,j) = pow(a(i,j), bd);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1445 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1446 else if ((a_nr == b_nr) && (a_nc == b_nc))
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1447 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1448 retval.resize(a_nr,a_nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1449 for (int j = 0; j < a_nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1450 for (int i = 0; i < a_nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1451 retval(i,j) = pow(a(i,j), b(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1452 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1453 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1454 gripe_nonconformant ("operator .^", a_nr, a_nc, a_nr, a_nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1455
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1456 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1457 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1458
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1459 FixedComplexMatrix elem_pow (const FixedComplexMatrix &a, const FixedPointComplex &b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1460 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1461 return elem_pow (a, FixedComplexMatrix(1, 1, b));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1462 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1463
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1464 FixedComplexMatrix elem_pow (const FixedPointComplex &a, const FixedComplexMatrix &b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1465 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1466 return elem_pow (FixedComplexMatrix(1, 1, a), b);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1467 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1468
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1469 FixedComplexMatrix pow (const FixedComplexMatrix& a, int b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1470 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1471 FixedComplexMatrix retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1472 int nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1473 int nc = a.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1474
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1475 if (nr == 0 || nc == 0 || nr != nc)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1476 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1477 ("for A^x, A must be square and x a real scalar");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1478 else if (b == 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1479 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1480 retval = a;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1481 FixedPointComplex one(1, 0, Complex(1, 0));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1482 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1483 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1484 retval(i,j) =
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1485 FixedPointComplex(a(i,j).getintsize(), a(i,j).getdecsize(), one);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1486 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1487 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1488 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1489 if (b < 0 )
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1490 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1491 ("can not treat matrix inversion");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1492
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1493 FixedComplexMatrix atmp (a);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1494 retval = atmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1495 b--;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1496 while (b > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1497 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1498 if (b & 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1499 retval = retval * atmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1500
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1501 b >>= 1;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1502
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1503 if (b > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1504 atmp = atmp * atmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1505 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1506 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1507 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1508 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1509
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1510 FixedComplexMatrix pow (const FixedComplexMatrix &a, const double b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1511 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1512 int bi = (int)b;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1513 if ((double)bi != b) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1514 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1515 ("can only treat integer powers of a matrix");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1516 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1517 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1518
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1519 return pow(a, bi);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1520 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1521
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1522 FixedComplexMatrix pow (const FixedComplexMatrix &a,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1523 const FixedPointComplex &b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1524 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1525 if (a.rows() == 0 || a.rows() == 0 || a.rows() != a.rows() ||
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1526 b.imag() != FixedPoint()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1527 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1528 ("for A^x, A must be square and x a real scalar");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1529 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1530 } else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1531 return pow(a, b.real().fixedpoint());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1532 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1533
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1534 FixedComplexMatrix pow (const FixedComplexMatrix &a, const FixedComplexMatrix &b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1535 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1536 if (a.rows() == 0 || a.rows() == 0 || a.rows() != a.rows() ||
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1537 b.rows() != 1 || b.cols() != 1 || b(0,0).imag() != FixedPoint()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1538 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1539 ("for A^x, A must be square and x a real scalar");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1540 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1541 } else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1542 return pow(a, b(0,0).real().fixedpoint());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1543 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1544
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1545 // Return true if no elements have imaginary components.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1546
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1547 bool
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1548 FixedComplexMatrix::all_elements_are_real (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1549 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1550 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1551 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1552 FixedPoint zero;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1553
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1554 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1555 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1556 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1557 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1558 FixedPoint ip = imag (elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1559
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1560 if (ip != zero || ip.signbit())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1561 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1562 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1563 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1564
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1565 return true;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1566 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1567
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1568 bool
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1569 FixedComplexMatrix::is_hermitian (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1570 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1571 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1572 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1573
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1574 if (is_square () && nr > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1575 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1576 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1577 for (int j = i; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1578 if (elem (i, j) != conj (elem (j, i)))
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1579 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1580
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1581 return true;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1582 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1583
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1584 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1585 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1586
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1587 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1588 FixedComplexMatrix::hermitian (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1589 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1590 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1591 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1592 FixedComplexMatrix result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1593 if (length () > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1594 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1595 result.resize (nc, nr);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1596 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1597 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1598 result.elem (j, i) = conj (elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1599 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1600 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1601 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1602
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1603 std::ostream&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1604 operator << (std::ostream& os, const FixedComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1605 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1606 for (int i = 0; i < a.rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1607 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1608 for (int j = 0; j < a.cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1609 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1610 os << " " << a.elem(i,j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1611 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1612 os << "\n";
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1613 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1614 return os;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1615 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1616
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1617 std::istream&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1618 operator >> (std::istream& is, FixedComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1619 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1620 int nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1621 int nc = a.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1622
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1623 if (nr < 1 || nc < 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1624 is.clear (std::ios::badbit);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1625 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1626 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1627 FixedPointComplex tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1628 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1629 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1630 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1631 is >> tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1632 if (is)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1633 a.elem (i, j) = tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1634 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1635 goto done;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1636 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1637 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1638
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1639 done:
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1640
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1641 return is;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1642 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1643
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1644 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1645 operator * (const FixedComplexMatrix& a, const FixedComplexMatrix& b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1646 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1647 FixedComplexMatrix retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1648
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1649 int a_nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1650 int a_nc = a.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1651
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1652 int b_nr = b.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1653 int b_nc = b.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1654
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1655 if (a_nc != b_nr)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1656 gripe_nonconformant ("operator *", a_nr, a_nc, b_nr, b_nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1657 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1658 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1659 retval.resize (a_nr, b_nc, FixedPointComplex());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1660 if (a_nr != 0 && a_nc != 0 && b_nc != 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1661 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1662 for (int j = 0; j < b_nr; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1663 for (int i = 0; i < b_nc; i++) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1664 FixedPointComplex tmp = b.elem(j,i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1665 for (int k = 0; k < a_nr; k++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1666 retval.elem (k,i) += a.elem(k,j) * tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1667 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1668 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1669 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1670
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1671 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1672 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1673
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1674 // XXX FIXME XXX -- it would be nice to share code among the min/max
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1675 // functions below.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1676
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1677 #define EMPTY_RETURN_CHECK(T) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1678 if (nr == 0 || nc == 0) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1679 return T (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1680
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1681 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1682 min (FixedPointComplex d, const FixedComplexMatrix& m)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1683 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1684 int nr = m.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1685 int nc = m.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1686 FixedPoint dabs = ::abs(d);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1687
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1688 EMPTY_RETURN_CHECK (FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1689
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1690 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1691
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1692 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1693 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1694 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1695 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1696 result (i, j) = ::abs(m(i,j)) < dabs ? m(i,j) : d;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1697 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1698
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1699 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1700 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1701
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1702 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1703 min (const FixedComplexMatrix& m, FixedPointComplex d)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1704 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1705 int nr = m.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1706 int nc = m.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1707 FixedPoint dabs = ::abs(d);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1708
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1709 EMPTY_RETURN_CHECK (FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1710
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1711 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1712
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1713 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1714 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1715 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1716 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1717 result (i, j) = ::abs(m(i,j)) < dabs ? m(i,j) : d;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1718 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1719
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1720 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1721 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1722
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1723 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1724 min (const FixedComplexMatrix& a, const FixedComplexMatrix& b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1725 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1726 int nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1727 int nc = a.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1728
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1729 if (nr != b.rows () || nc != b.columns ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1730 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1731 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1732 ("two-arg min expecting args of same size");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1733 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1734 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1735
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1736 EMPTY_RETURN_CHECK (FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1737
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1738 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1739
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1740 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1741 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1742 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1743 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1744 result (i, j) = ::abs(a(i,j)) < ::abs(b(i,j)) ? a(i,j) : b(i,j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1745
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1746 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1747
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1748 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1749 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1750
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1751 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1752 max (FixedPointComplex d, const FixedComplexMatrix& m)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1753 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1754 int nr = m.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1755 int nc = m.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1756 FixedPoint dabs = ::abs(d);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1757
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1758 EMPTY_RETURN_CHECK (FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1759
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1760 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1761
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1762 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1763 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1764 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1765 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1766 result (i, j) = ::abs(m(i,j)) > dabs ? m(i,j) : d;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1767 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1768
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1769 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1770 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1771
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1772 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1773 max (const FixedComplexMatrix& m, FixedPointComplex d)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1774 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1775 int nr = m.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1776 int nc = m.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1777 FixedPoint dabs = ::abs(d);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1778
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1779 EMPTY_RETURN_CHECK (FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1780
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1781 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1782
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1783 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1784 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1785 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1786 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1787 result (i, j) = ::abs(m(i,j)) > dabs ? m(i,j) : d;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1788 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1789
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1790 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1791 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1792
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1793 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1794 max (const FixedComplexMatrix& a, const FixedComplexMatrix& b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1795 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1796 int nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1797 int nc = a.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1798
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1799 if (nr != b.rows () || nc != b.columns ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1800 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1801 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1802 ("two-arg max expecting args of same size");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1803 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1804 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1805
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1806 EMPTY_RETURN_CHECK (FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1807
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1808 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1809
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1810 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1811 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1812 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1813 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1814 result (i, j) = ::abs(a(i,j)) > ::abs(b(i,j)) ? a(i,j) : b(i,j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1815 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1816
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1817 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1818 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1819
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1820 MS_CMP_OPS(FixedComplexMatrix, real, FixedPointComplex, real)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1821 MS_BOOL_OPS(FixedComplexMatrix, FixedPointComplex, FixedPointComplex())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1822
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1823 SM_CMP_OPS(FixedPointComplex, real, FixedComplexMatrix, real)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1824 SM_BOOL_OPS(FixedPointComplex, FixedComplexMatrix, FixedPointComplex())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1825
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1826 MM_CMP_OPS(FixedComplexMatrix, real, FixedComplexMatrix, real)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1827 MM_BOOL_OPS(FixedComplexMatrix, FixedComplexMatrix, FixedPointComplex())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1828
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1829 /*
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1830 ;;; Local Variables: ***
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1831 ;;; mode: C++ ***
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1832 ;;; End: ***
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1833 */