annotate main/fixed/src/fixedCMatrix.cc @ 9481:d84d2fea3c90 octave-forge

Re-enable compilation of fixed package
author jordigh
date Wed, 22 Feb 2012 22:07:33 +0000
parents 52f21a12e35b
children
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
5655
0924c374b60d Update fixed point code for 3.1.x. Minor bug in test code still present though code seems to work fine
adb014
parents: 5248
diff changeset
45 #include "fixed-inline.cc"
0924c374b60d Update fixed point code for 3.1.x. Minor bug in test code still present though code seems to work fine
adb014
parents: 5248
diff changeset
46
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
47 // Fixed Point Complex Matrix class.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
48
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
49 FixedComplexMatrix::FixedComplexMatrix (const MArray<int> &is,
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
50 const MArray<int> &ds)
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
51 : MArray<FixedPointComplex> (dim_vector (is.rows(), is.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
52 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
53 if ((rows() != ds.rows()) || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
54 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
55 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
56 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
57
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
58 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
59 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
60 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
61 (unsigned int)ds(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
62 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
63
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
64 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
65 : MArray<FixedPointComplex> (dim_vector (is.rows(), is.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
66 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
67 if ((rows() != ds.rows()) || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
68 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
69 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
70 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
71
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
72 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
73 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
74 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
75 (unsigned int)ds(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
76 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
77
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
78 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
79 const ComplexMatrix &ds)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
80 : MArray<FixedPointComplex> (dim_vector (is.rows(), is.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
81 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
82 if ((rows() != ds.rows()) || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
83 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
84 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
85 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
86
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
87 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
88 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
89 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
90 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
91
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
92 FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
93 const FixedComplexMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
94 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
95 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
96 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
97 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
98 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
99 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
100
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
101 FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
102 const FixedComplexMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
103 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
104 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
105 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
106 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
107 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
108 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
109
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
110 FixedComplexMatrix::FixedComplexMatrix (const MArray<int> &is,
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
111 const MArray<int> &ds, const FixedComplexMatrix& a)
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
112 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
113 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
114 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
115 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
116 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
117 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
118 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
119
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
120 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
121 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
122 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
123 (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
124 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
125
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
126 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
127 const FixedComplexMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
128 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
129 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
130 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
131 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
132 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
133 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
134 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
135
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
136 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
137 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
138 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
139 (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
140 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
141
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
142 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
143 const ComplexMatrix &ds, const FixedComplexMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
144 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
145 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
146 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
147 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
148 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
149 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
150 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
151
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
152 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
153 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
154 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
155 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
156
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
157 FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
158 const FixedMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
159 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
160 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
161 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
162 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
163 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
164 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
165
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
166 FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
167 const FixedMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
168 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
169 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
170 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
171 for (int i = 0; i < rows (); i++)
3071
fa041e4681b4 Fix MSVC compilation.
goffioul
parents: 2914
diff changeset
172 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
173 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
174
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
175 FixedComplexMatrix::FixedComplexMatrix (const MArray<int> &is,
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
176 const MArray<int> &ds, const FixedMatrix& a)
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
177 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
178 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
179 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
180 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
181 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
182 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
183 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
184
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
185 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
186 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
187 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
188 (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
189 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
190
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
191 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
192 const FixedMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
193 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
194 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
195 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
196 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
197 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
198 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
199 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
200
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
201 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
202 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
203 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
204 (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
205 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
206
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
207 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
208 const ComplexMatrix &ds, const FixedMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
209 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
210 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
211 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
212 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
213 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
214 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
215 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
216
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
217 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
218 for (int i = 0; i < rows (); i++)
3071
fa041e4681b4 Fix MSVC compilation.
goffioul
parents: 2914
diff changeset
219 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
220 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
221
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
222 FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
223 const ComplexMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
224 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
225 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
226 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
227 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
228 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
229 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
230
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
231 FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
232 const ComplexMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
233 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
234 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
235 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
236 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
237 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
238 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
239
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
240 FixedComplexMatrix::FixedComplexMatrix (const MArray<int> &is,
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
241 const MArray<int> &ds, const ComplexMatrix& a)
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
242 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
243 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
244 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
245 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
246 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
247 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
248 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
249
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
250 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
251 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
252 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
253 (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
254 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
255
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
256 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
257 const ComplexMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
258 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
259 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
260 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
261 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
262 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
263 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
264 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
265
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
266 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
267 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
268 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
269 (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
270 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
271
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
272 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
273 const ComplexMatrix &ds, const ComplexMatrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
274 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
275 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
276 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
277 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
278 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
279 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
280 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
281
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
282 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
283 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
284 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
285 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
286
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
287 FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
288 const Matrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
289 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
290 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
291 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
292 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
293 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
294 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
295
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
296 FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
297 const Matrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
298 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
299 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
300 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
301 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
302 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
303 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
304
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
305 FixedComplexMatrix::FixedComplexMatrix (const MArray<int> &is,
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
306 const MArray<int> &ds, const Matrix& a)
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
307 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
308 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
309 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
310 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
311 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
312 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
313 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
314
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
315 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
316 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
317 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
318 (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
319 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
320
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
321 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
322 const Matrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
323 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
324 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
325 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
326 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
327 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
328 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
329 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
330
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
331 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
332 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
333 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
334 (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
335 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
336
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
337 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
338 const ComplexMatrix &ds, const Matrix& a)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
339 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
340 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
341 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
342 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
343 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
344 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
345 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
346
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
347 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
348 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
349 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
350 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
351
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
352
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
353 FixedComplexMatrix::FixedComplexMatrix (unsigned int is, unsigned int ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
354 const ComplexMatrix& a, const ComplexMatrix& b)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
355 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
356 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
357 if ((rows() != b.rows()) || (cols() != b.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
358 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
359 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
360 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
361
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
362 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
363 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
364 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
365 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
366
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
367 FixedComplexMatrix::FixedComplexMatrix (Complex is, Complex ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
368 const ComplexMatrix& a, const ComplexMatrix& b)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
369 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
370 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
371 if ((rows() != b.rows()) || (cols() != b.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
372 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
373 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
374 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
375
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
376 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
377 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
378 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
379 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
380
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
381 FixedComplexMatrix::FixedComplexMatrix (const MArray<int> &is,
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
382 const MArray<int> &ds, const ComplexMatrix& a,
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
383 const ComplexMatrix& b)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
384 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
385 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
386 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
387 || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
388 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
389 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
390 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
391 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
392
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
393 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
394 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
395 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
396 b.elem(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
397 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
398
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
399 FixedComplexMatrix::FixedComplexMatrix (const Matrix &is, const Matrix &ds,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
400 const ComplexMatrix& a, const ComplexMatrix& b)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
401 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
402 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
403 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
404 || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
405 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
406 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
407 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
408 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
409
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
410 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
411 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
412 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
413 (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
414 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
415
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
416 FixedComplexMatrix::FixedComplexMatrix (const ComplexMatrix &is,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
417 const ComplexMatrix &ds, const ComplexMatrix& a,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
418 const ComplexMatrix& b)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
419 : MArray<FixedPointComplex> (dim_vector (a.rows(), a.cols()))
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
420 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
421 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
422 || (cols() != is.cols()) || (rows() != ds.rows())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
423 || (cols() != ds.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
424 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
425 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
426 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
427
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
428 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
429 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
430 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
431 b.elem(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
432 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
433
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
434 FixedComplexMatrix::FixedComplexMatrix (const FixedComplexRowVector& rv)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
435 : MArray<FixedPointComplex> (dim_vector (1, rv.length ()), FixedPointComplex())
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
436 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
437 for (int i = 0; i < rv.length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
438 elem (0, i) = rv.elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
439 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
440
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
441 FixedComplexMatrix::FixedComplexMatrix (const FixedRowVector& rv)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
442 : MArray<FixedPointComplex> (dim_vector (1, rv.length ()), FixedPointComplex())
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
443 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
444 for (int i = 0; i < rv.length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
445 elem (0, i) = FixedPointComplex(rv.elem (i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
446 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
447
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
448 FixedComplexMatrix::FixedComplexMatrix (const FixedComplexColumnVector& cv)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
449 : MArray<FixedPointComplex> (dim_vector (cv.length (), 1), FixedPointComplex())
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
450 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
451 for (int i = 0; i < cv.length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
452 elem (i, 0) = cv.elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
453 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
454
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
455 FixedComplexMatrix::FixedComplexMatrix (const FixedColumnVector& cv)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
456 : MArray<FixedPointComplex> (dim_vector (cv.length (), 1), FixedPointComplex())
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
457 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
458 for (int i = 0; i < cv.length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
459 elem (i, 0) = FixedPointComplex(cv.elem (i));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
460 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
461
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
462 FixedComplexMatrix::FixedComplexMatrix (const FixedMatrix& m)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
463 : MArray<FixedPointComplex> (dim_vector (m.rows (), m.cols ()), FixedPointComplex())
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
464 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
465 for (int j = 0; j < m.cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
466 for (int i = 0; i < m.rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
467 elem (i, j) = FixedPointComplex(m.elem (i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
468 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
469
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
470 FixedComplexMatrix::FixedComplexMatrix (const FixedMatrix& a,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
471 const FixedMatrix& b)
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
472 : MArray<FixedPointComplex> (dim_vector (a.rows (), a.cols ()), FixedPointComplex())
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
473 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
474 if ((rows() != b.rows()) || (cols() != b.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
475 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
476 return;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
477 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
478 for (int j = 0; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
479 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
480 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
481 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
482
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
483 #define GET_FIXED_PROP(METHOD) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
484 ComplexMatrix \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
485 FixedComplexMatrix:: METHOD (void) const \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
486 { \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
487 int nr = rows(); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
488 int nc = cols(); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
489 ComplexMatrix retval(nr,nc); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
490 for (int i = 0; i < nr; i++) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
491 for (int j = 0; j < nc; j++) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
492 retval(i,j) = elem(i,j) . METHOD (); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
493 return retval; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
494 } \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
495
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
496 GET_FIXED_PROP(sign);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
497 GET_FIXED_PROP(getdecsize);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
498 GET_FIXED_PROP(getintsize);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
499 GET_FIXED_PROP(getnumber);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
500 GET_FIXED_PROP(fixedpoint);
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 #undef GET_FIXED_PROP
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
503
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
504 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
505 FixedComplexMatrix::chdecsize (const Complex n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
506 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
507 int nr = rows();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
508 int nc = cols();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
509 FixedComplexMatrix retval(nr,nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
510
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
511 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
512 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
513 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
514
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
515 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
516 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
517
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
518 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
519 FixedComplexMatrix::chdecsize (const ComplexMatrix &n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
520 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
521 int nr = rows();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
522 int nc = cols();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
523
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
524 if ((nr != n.rows()) || (nc != n.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
525 (*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
526 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
527 }
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 FixedComplexMatrix retval(nr,nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
530
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
531 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
532 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
533 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
534 elem(i,j));
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 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
537 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
538
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
539 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
540 FixedComplexMatrix::chintsize (const Complex n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
541 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
542 int nr = rows();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
543 int nc = cols();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
544 FixedComplexMatrix retval(nr,nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
545
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
546 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
547 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
548 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
549
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
550 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
551 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
552
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
553 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
554 FixedComplexMatrix::chintsize (const ComplexMatrix &n)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
555 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
556 int nr = rows();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
557 int nc = cols();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
558
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
559 if ((nr != n.rows()) || (nc != n.cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
560 (*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
561 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
562 }
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 FixedComplexMatrix retval(nr,nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
565
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
566 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
567 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
568 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
569 elem(i,j));
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 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
572 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
573
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
574 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
575 FixedComplexMatrix::incdecsize (const Complex n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
576 return chdecsize(n + getdecsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
577 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
578
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
579 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
580 FixedComplexMatrix::incdecsize (const ComplexMatrix &n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
581 if ((n.rows() != rows()) || (n.cols() != cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
582 (*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
583 return FixedComplexMatrix();
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 return chdecsize(n + getdecsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
586 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
587
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
588 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
589 FixedComplexMatrix::incdecsize () {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
590 return chdecsize(Complex(1,1) + getdecsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
591 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
592
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
593 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
594 FixedComplexMatrix::incintsize (const Complex n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
595 return chintsize(n + getintsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
596 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
597
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
598 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
599 FixedComplexMatrix::incintsize (const ComplexMatrix &n) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
600 if ((n.rows() != rows()) || (n.cols() != cols())) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
601 (*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
602 return FixedComplexMatrix();
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 return chintsize(n + getintsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
605 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
606
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
607 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
608 FixedComplexMatrix::incintsize () {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
609 return chintsize(Complex(1,1) + getintsize());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
610 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
611
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
612 bool
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
613 FixedComplexMatrix::operator == (const FixedComplexMatrix& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
614 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
615 if (rows () != a.rows () || cols () != a.cols ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
616 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
617
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
618 for (int i = 0; i < rows(); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
619 for (int j = 0; j < cols(); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
620 if (elem(i,j) != a.elem(i,j))
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
621 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
622 return true;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
623 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
624
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
625 bool
2914
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
626 FixedComplexMatrix::operator != (const FixedComplexMatrix& a) const
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
627 {
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
628 return !(*this == a);
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
629 }
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
630
e2142eefb50d Add missing != to matrix classes
adb014
parents: 2394
diff changeset
631 bool
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
632 FixedComplexMatrix::is_symmetric (void) const
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 if (is_square () && rows () > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
635 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
636 for (int i = 0; i < rows (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
637 for (int j = i+1; j < cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
638 if (elem (i, j) != elem (j, i))
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
639 return false;
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 return true;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
642 }
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 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
645 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
646
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
647 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
648 FixedComplexMatrix::concat (const FixedComplexMatrix& rb,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
649 const Array<int>& ra_idx)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
650 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
651 if (rb.numel() > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
652 insert (rb, ra_idx(0), ra_idx(1));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
653 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
654 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
655
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
656 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
657 FixedComplexMatrix::concat (const FixedMatrix& rb,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
658 const Array<int>& ra_idx)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
659 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
660 if (rb.numel() > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
661 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
662 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
663 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
664
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
665 FixedComplexMatrix&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
666 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
667 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
668 Array<FixedPointComplex>::insert (a, r, c);
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
669 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
670 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
671
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
672 FixedComplexMatrix&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
673 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
674 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
675 int a_len = a.length ();
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 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
678 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
679 (*current_liboctave_error_handler) ("range error for insert");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
680 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
681 }
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 if (a_len > 0)
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 make_unique ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
686
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
687 for (int i = 0; i < a_len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
688 xelem (r, c+i) = a.elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
689 }
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 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
692 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
693
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
694 FixedComplexMatrix&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
695 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
696 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
697 int a_len = a.length ();
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 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
700 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
701 (*current_liboctave_error_handler) ("range error for insert");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
702 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
703 }
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 if (a_len > 0)
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 make_unique ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
708
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
709 for (int i = 0; i < a_len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
710 xelem (r+i, c) = a.elem (i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
711 }
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 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
714 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
715
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
716 FixedComplexMatrix&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
717 FixedComplexMatrix::fill (FixedPointComplex val)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
718 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
719 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
720 int nc = cols ();
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 if (nr > 0 && nc > 0)
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 make_unique ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
725
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
726 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
727 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
728 xelem (i, j) = val;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
729 }
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 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
732 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
733
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
734 FixedComplexMatrix&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
735 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
736 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
737 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
738 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
739
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
740 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
741 || r1 >= nr || r2 >= nr || c1 >= nc || c2 >= nc)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
742 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
743 (*current_liboctave_error_handler) ("range error for fill");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
744 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
745 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
746
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
747 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
748 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
749
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
750 if (r2 >= r1 && c2 >= c1)
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 make_unique ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
753
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
754 for (int j = c1; j <= c2; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
755 for (int i = r1; i <= r2; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
756 xelem (i, j) = val;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
757 }
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 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
760 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
761
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
762 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
763 FixedComplexMatrix::append (const FixedComplexMatrix& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
764 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
765 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
766 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
767 if (nr != a.rows ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
768 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
769 (*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
770 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
771 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
772
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
773 int nc_insert = nc;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
774 FixedComplexMatrix retval (nr, nc + a.cols ());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
775 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
776 retval.insert (a, 0, nc_insert);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
777 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
778 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
779
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
780 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
781 FixedComplexMatrix::append (const FixedComplexRowVector& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
782 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
783 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
784 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
785 if (nr != 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
786 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
787 (*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
788 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
789 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
790
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
791 int nc_insert = nc;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
792 FixedComplexMatrix retval (nr, nc + a.length ());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
793 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
794 retval.insert (a, 0, nc_insert);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
795 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
796 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
797
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
798 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
799 FixedComplexMatrix::append (const FixedComplexColumnVector& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
800 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
801 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
802 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
803 if (nr != a.length ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
804 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
805 (*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
806 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
807 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
808
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
809 int nc_insert = nc;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
810 FixedComplexMatrix retval (nr, nc + 1);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
811 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
812 retval.insert (a, 0, nc_insert);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
813 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
814 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
815
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
816 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
817 FixedComplexMatrix::stack (const FixedComplexMatrix& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
818 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
819 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
820 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
821 if (nc != a.cols ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
822 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
823 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
824 ("column dimension mismatch for stack");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
825 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
826 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
827
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
828 int nr_insert = nr;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
829 FixedComplexMatrix retval (nr + a.rows (), nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
830 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
831 retval.insert (a, nr_insert, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
832 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
833 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
834
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
835 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
836 FixedComplexMatrix::stack (const FixedComplexRowVector& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
837 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
838 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
839 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
840 if (nc != a.length ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
841 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
842 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
843 ("column dimension mismatch for stack");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
844 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
845 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
846
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
847 int nr_insert = nr;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
848 FixedComplexMatrix retval (nr + 1, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
849 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
850 retval.insert (a, nr_insert, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
851 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
852 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
853
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
854 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
855 FixedComplexMatrix::stack (const FixedComplexColumnVector& a) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
856 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
857 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
858 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
859 if (nc != 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
860 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
861 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
862 ("column dimension mismatch for stack");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
863 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
864 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
865
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
866 int nr_insert = nr;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
867 FixedComplexMatrix retval (nr + a.length (), nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
868 retval.insert (*this, 0, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
869 retval.insert (a, nr_insert, 0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
870 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
871 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
872
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
873 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
874 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
875 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
876 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
877 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
878
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
879 int new_r = r2 - r1 + 1;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
880 int new_c = c2 - c1 + 1;
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 FixedComplexMatrix result (new_r, new_c);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
883
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
884 for (int j = 0; j < new_c; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
885 for (int i = 0; i < new_r; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
886 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
887
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
888 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
889 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
890
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
891 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
892 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
893 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
894 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
895
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
896 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
897 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
898 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
899
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
900 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
901 }
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 // extract row or column i.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
904
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
905 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
906 FixedComplexMatrix::row (int i) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
907 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
908 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
909 if (i < 0 || i >= rows ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
910 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
911 (*current_liboctave_error_handler) ("invalid row selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
912 return FixedComplexRowVector ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
913 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
914
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
915 FixedComplexRowVector retval (nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
916 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
917 retval.xelem (j) = elem (i, j);
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 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
920 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
921
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
922 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
923 FixedComplexMatrix::row (char *s) const
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 if (! s)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
926 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
927 (*current_liboctave_error_handler) ("invalid row selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
928 return FixedComplexRowVector ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
929 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
930
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
931 char c = *s;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
932 if (c == 'f' || c == 'F')
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
933 return row (0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
934 else if (c == 'l' || c == 'L')
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
935 return row (rows () - 1);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
936 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
937 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
938 (*current_liboctave_error_handler) ("invalid row selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
939 return FixedComplexRowVector ();
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 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
942
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
943 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
944 FixedComplexMatrix::column (int i) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
945 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
946 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
947 if (i < 0 || i >= cols ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
948 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
949 (*current_liboctave_error_handler) ("invalid column selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
950 return FixedComplexColumnVector ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
951 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
952
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
953 FixedComplexColumnVector retval (nr);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
954 for (int j = 0; j < nr; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
955 retval.xelem (j) = elem (j, i);
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 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
958 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
959
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
960 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
961 FixedComplexMatrix::column (char *s) const
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 if (! s)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
964 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
965 (*current_liboctave_error_handler) ("invalid column selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
966 return FixedComplexColumnVector ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
967 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
968
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
969 char c = *s;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
970 if (c == 'f' || c == 'F')
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
971 return column (0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
972 else if (c == 'l' || c == 'L')
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
973 return column (cols () - 1);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
974 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
975 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
976 (*current_liboctave_error_handler) ("invalid column selection");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
977 return FixedComplexColumnVector ();
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 }
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 // unary operations
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
982
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
983 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
984 FixedComplexMatrix::operator ! (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
985 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
986 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
987 int nc = cols ();
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 FixedComplexMatrix b (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
990
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
991 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
992 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
993 b.elem (i, j) = ! elem (i, j) ;
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 return b;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
996 }
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 // column vector by row vector -> matrix operations
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
999
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1000 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1001 operator * (const FixedComplexColumnVector& v, const FixedComplexRowVector& a)
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 FixedComplexMatrix retval;
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 int len = v.length ();
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 if (len != 0)
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 int a_len = a.length ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1010
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1011 retval.resize (dim_vector (len, a_len));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1012
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1013 for (int i = 0; i < len; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1014 for (int j = 0; j < a_len; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1015 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
1016 }
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 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1019 }
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 // other operations.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1022
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1023 FixedComplexMatrix
5248
f8d77845533f Changes for compilation with 3.1.51+
adb014
parents: 4404
diff changeset
1024 FixedComplexMatrix::map (fpc_fpc_Mapper f) const
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1025 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1026 FixedComplexMatrix b (*this);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1027 return b.apply (f);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1028 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1029
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1030 FixedComplexMatrix&
5248
f8d77845533f Changes for compilation with 3.1.51+
adb014
parents: 4404
diff changeset
1031 FixedComplexMatrix::apply (fpc_fpc_Mapper f)
2383
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 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
1034
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1035 for (int i = 0; i < length (); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1036 d[i] = f (d[i]);
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 return *this;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1039 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1040
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1041 boolMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1042 FixedComplexMatrix::all (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1043 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1044 return do_mx_red_op<bool, FixedPointComplex> (*this, dim, mx_inline_all);
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1045 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1046
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1047 boolMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1048 FixedComplexMatrix::any (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1049 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1050 return do_mx_red_op<bool, FixedPointComplex> (*this, dim, mx_inline_any);
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1051 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1052
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1053 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1054 FixedComplexMatrix::cumprod (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1055 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1056 return do_mx_cum_op<FixedPointComplex, FixedPointComplex> (*this, dim, mx_inline_cumprod);
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1057 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1058
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1059 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1060 FixedComplexMatrix::cumsum (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1061 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1062 return do_mx_cum_op<FixedPointComplex, FixedPointComplex> (*this, dim, mx_inline_cumsum);
2383
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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1065 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1066 FixedComplexMatrix::prod (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1067 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1068 return do_mx_red_op<FixedPointComplex, FixedPointComplex> (*this, dim, mx_inline_prod);
2383
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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1071 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1072 FixedComplexMatrix::sum (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1073 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1074 return do_mx_red_op<FixedPointComplex, FixedPointComplex> (*this, dim, mx_inline_sum);
2383
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 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1078 FixedComplexMatrix::sumsq (int dim) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1079 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1080 return do_mx_red_op<FixedPointComplex, FixedPointComplex> (*this, dim, mx_inline_sumsq);
2383
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::abs (void) 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 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1087 int nc = cols ();
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 retval (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1090
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1091 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1092 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1093 retval (i, j) = ::abs(elem (i, j));
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 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1096 }
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 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1099 FixedComplexMatrix::diag (void) const
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 return diag (0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1102 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1103
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1104 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1105 FixedComplexMatrix::diag (int k) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1106 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1107 int nnr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1108 int nnc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1109 if (k > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1110 nnc -= k;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1111 else if (k < 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1112 nnr += k;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1113
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1114 FixedComplexColumnVector d;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1115
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1116 if (nnr > 0 && nnc > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1117 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1118 int ndiag = (nnr < nnc) ? nnr : nnc;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1119
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1120 d.resize (ndiag);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1121
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1122 if (k > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1123 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1124 for (int i = 0; i < ndiag; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1125 d.elem (i) = elem (i, i+k);
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 else if ( k < 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1128 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1129 for (int i = 0; i < ndiag; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1130 d.elem (i) = elem (i-k, i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1131 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1132 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1133 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1134 for (int i = 0; i < ndiag; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1135 d.elem (i) = elem (i, i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1136 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1137 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1138 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1139 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
1140
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1141 return d;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1142 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1143
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1144 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1145 FixedComplexMatrix::row_min (void) const
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 Array<int> index;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1148 return row_min (index);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1149 }
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 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1152 FixedComplexMatrix::row_min (Array<int>& index) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1153 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1154 FixedComplexColumnVector result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1155
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1156 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1157 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1158
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1159 if (nr > 0 && nc > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1160 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1161 result.resize (nr);
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1162 index.resize (dim_vector (nr, 1));
2383
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 for (int i = 0; i < nr; i++)
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 int idx_j = 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 FixedPointComplex tmp_min = elem (i, idx_j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1169 FixedPoint tmp_min_abs = ::abs(tmp_min);
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 for (int j = 1; j < nc; j++)
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 FixedPointComplex tmp = elem (i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1174 FixedPoint tmp_abs = ::abs(tmp);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1175 if (tmp_abs < tmp_min_abs)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1176 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1177 idx_j = j;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1178 tmp_min = tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1179 tmp_min_abs = tmp_abs;
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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1183 result.elem (i) = tmp_min;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1184 index.elem (i) = idx_j;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1185 }
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 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1189 }
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 FixedComplexColumnVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1192 FixedComplexMatrix::row_max (void) const
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 Array<int> index;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1195 return row_max (index);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1196 }
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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1199 FixedComplexMatrix::row_max (Array<int>& index) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1200 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1201 FixedComplexColumnVector result;
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 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1204 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1205
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1206 if (nr > 0 && nc > 0)
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 result.resize (nr);
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1209 index.resize (dim_vector (nr, 1));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1210
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1211 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1212 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1213 int idx_j = 0;
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 FixedPointComplex tmp_max = elem (i, idx_j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1216 FixedPoint tmp_max_abs = ::abs(tmp_max);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1217
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1218 for (int j = 1; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1219 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1220 FixedPointComplex tmp = elem (i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1221 FixedPoint tmp_abs = ::abs(tmp);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1222 if (tmp_abs > tmp_max_abs)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1223 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1224 idx_j = j;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1225 tmp_max = tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1226 tmp_max_abs = tmp_abs;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1227 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1228 }
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 result.elem (i) = tmp_max;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1231 index.elem (i) = idx_j;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1232 }
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 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1236 }
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 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1239 FixedComplexMatrix::column_min (void) const
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 Array<int> index;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1242 return column_min (index);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1243 }
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 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1246 FixedComplexMatrix::column_min (Array<int>& index) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1247 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1248 FixedComplexRowVector result;
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 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1251 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1252
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1253 if (nr > 0 && nc > 0)
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 result.resize (nc);
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1256 index.resize (dim_vector (1, nc));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1257
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1258 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1259 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1260 int idx_i = 0;
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 FixedPointComplex tmp_min = elem (idx_i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1263 FixedPoint tmp_min_abs = ::abs(tmp_min);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1264
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1265 for (int i = 1; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1266 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1267 FixedPointComplex tmp = elem (i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1268 FixedPoint tmp_abs = ::abs(tmp);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1269 if (tmp_abs < tmp_min_abs)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1270 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1271 idx_i = i;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1272 tmp_min = tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1273 tmp_min_abs = tmp_abs;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1274 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1275 }
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 result.elem (j) = tmp_min;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1278 index.elem (j) = idx_i;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1279 }
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 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1283 }
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 FixedComplexRowVector
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1286 FixedComplexMatrix::column_max (void) const
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 Array<int> index;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1289 return column_max (index);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1290 }
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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1293 FixedComplexMatrix::column_max (Array<int>& index) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1294 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1295 FixedComplexRowVector result;
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 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1298 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1299
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1300 if (nr > 0 && nc > 0)
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 result.resize (nc);
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1303 index.resize (dim_vector (1, nc));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1304
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1305 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1306 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1307 int idx_i = 0;
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 FixedPointComplex tmp_max = elem (idx_i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1310 FixedPoint tmp_max_abs = ::abs(tmp_max);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1311
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1312 for (int i = 1; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1313 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1314 FixedPointComplex tmp = elem (i, j);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1315 FixedPoint tmp_abs = ::abs(tmp);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1316
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1317 if (tmp_abs > tmp_max_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 idx_i = i;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1320 tmp_max = tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1321 tmp_max_abs = tmp_abs;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1322 }
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 result.elem (j) = tmp_max;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1326 index.elem (j) = idx_i;
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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1330 return result;
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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1333 #define DO_FIXED_MAT_FUNC(FUNC, MT) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1334 MT FUNC (const FixedComplexMatrix& x) \
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 MT retval ( x.rows(), x.cols()); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1337 for (int j = 0; j < x.cols(); j++) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1338 for (int i = 0; i < x.rows(); i++) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1339 retval(i,j) = FUNC ( x (i,j) ); \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1340 return retval; \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1341 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1342
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1343 DO_FIXED_MAT_FUNC(real, FixedMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1344 DO_FIXED_MAT_FUNC(imag, FixedMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1345 DO_FIXED_MAT_FUNC(conj, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1346 DO_FIXED_MAT_FUNC(abs, FixedMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1347 DO_FIXED_MAT_FUNC(norm, FixedMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1348 DO_FIXED_MAT_FUNC(arg, FixedMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1349 DO_FIXED_MAT_FUNC(cos, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1350 DO_FIXED_MAT_FUNC(cosh, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1351 DO_FIXED_MAT_FUNC(sin, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1352 DO_FIXED_MAT_FUNC(sinh, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1353 DO_FIXED_MAT_FUNC(tan, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1354 DO_FIXED_MAT_FUNC(tanh, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1355 DO_FIXED_MAT_FUNC(sqrt, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1356 DO_FIXED_MAT_FUNC(exp, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1357 DO_FIXED_MAT_FUNC(log, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1358 DO_FIXED_MAT_FUNC(log10, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1359 DO_FIXED_MAT_FUNC(round, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1360 DO_FIXED_MAT_FUNC(rint, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1361 DO_FIXED_MAT_FUNC(floor, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1362 DO_FIXED_MAT_FUNC(ceil, FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1363
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1364 FixedComplexMatrix polar (const FixedMatrix &r, const FixedMatrix &p)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1365 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1366 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
1367 (*current_liboctave_error_handler) ("matrix size mismatch");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1368 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1369 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1370
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1371 FixedComplexMatrix retval ( r.rows(), r.cols());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1372 for (int j = 0; j < r.cols(); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1373 for (int i = 0; i < r.rows(); i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1374 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
1375 return retval;
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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1378 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
1379 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1380 FixedComplexMatrix retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1381 int a_nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1382 int a_nc = a.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1383 int b_nr = b.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1384 int b_nc = b.cols ();
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 if (a_nr == 1 && a_nc == 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1387 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1388 retval.resize(dim_vector (b_nr,b_nc));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1389 FixedPointComplex ad = a(0,0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1390 for (int j = 0; j < b_nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1391 for (int i = 0; i < b_nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1392 retval(i,j) = pow(ad, b(i,j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1393 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1394 else if (b_nr == 1 && b_nc == 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1395 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1396 retval.resize(dim_vector (a_nr,a_nc));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1397 FixedPointComplex bd = b(0,0);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1398 for (int j = 0; j < a_nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1399 for (int i = 0; i < a_nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1400 retval(i,j) = pow(a(i,j), bd);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1401 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1402 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
1403 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1404 retval.resize(dim_vector (a_nr,a_nc));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1405 for (int j = 0; j < a_nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1406 for (int i = 0; i < a_nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1407 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
1408 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1409 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1410 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
1411
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1412 return retval;
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 elem_pow (const FixedComplexMatrix &a, const FixedPointComplex &b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1416 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1417 return elem_pow (a, FixedComplexMatrix(1, 1, b));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1418 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1419
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1420 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
1421 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1422 return elem_pow (FixedComplexMatrix(1, 1, a), 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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1425 FixedComplexMatrix pow (const FixedComplexMatrix& a, int b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1426 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1427 FixedComplexMatrix retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1428 int nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1429 int nc = a.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1430
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1431 if (nr == 0 || nc == 0 || nr != nc)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1432 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1433 ("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
1434 else if (b == 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1435 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1436 retval = a;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1437 FixedPointComplex one(1, 0, Complex(1, 0));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1438 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1439 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1440 retval(i,j) =
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1441 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
1442 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1443 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1444 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1445 if (b < 0 )
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1446 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1447 ("can not treat matrix inversion");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1448
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1449 FixedComplexMatrix atmp (a);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1450 retval = atmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1451 b--;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1452 while (b > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1453 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1454 if (b & 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1455 retval = retval * atmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1456
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1457 b >>= 1;
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 if (b > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1460 atmp = atmp * atmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1461 }
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 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1464 }
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 FixedComplexMatrix pow (const FixedComplexMatrix &a, const double 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 int bi = (int)b;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1469 if ((double)bi != b) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1470 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1471 ("can only treat integer powers of a matrix");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1472 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1473 }
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 return pow(a, bi);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1476 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1477
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1478 FixedComplexMatrix pow (const FixedComplexMatrix &a,
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1479 const FixedPointComplex &b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1480 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1481 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
1482 b.imag() != FixedPoint()) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1483 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1484 ("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
1485 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1486 } else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1487 return pow(a, b.real().fixedpoint());
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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1490 FixedComplexMatrix pow (const FixedComplexMatrix &a, const FixedComplexMatrix &b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1491 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1492 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
1493 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
1494 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1495 ("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
1496 return FixedComplexMatrix();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1497 } else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1498 return pow(a, b(0,0).real().fixedpoint());
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1499 }
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 // Return true if no elements have imaginary components.
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 bool
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1504 FixedComplexMatrix::all_elements_are_real (void) const
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 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1507 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1508 FixedPoint zero;
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 for (int j = 0; j < nc; j++)
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 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1513 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1514 FixedPoint ip = imag (elem (i, j));
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1515
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1516 if (ip != zero || ip.signbit())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1517 return false;
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 }
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 return true;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1522 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1523
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1524 bool
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1525 FixedComplexMatrix::is_hermitian (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1526 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1527 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1528 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1529
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1530 if (is_square () && nr > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1531 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1532 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1533 for (int j = i; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1534 if (elem (i, j) != conj (elem (j, i)))
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1535 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1536
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1537 return true;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1538 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1539
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1540 return false;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1541 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1542
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1543 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1544 FixedComplexMatrix::hermitian (void) const
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1545 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1546 int nr = rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1547 int nc = cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1548 FixedComplexMatrix result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1549 if (length () > 0)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1550 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1551 result.resize (dim_vector (nc, nr));
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1552 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1553 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1554 result.elem (j, i) = conj (elem (i, 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 return result;
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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1559 std::ostream&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1560 operator << (std::ostream& os, const FixedComplexMatrix& a)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1561 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1562 for (int i = 0; i < a.rows (); i++)
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 for (int j = 0; j < a.cols (); j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1565 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1566 os << " " << a.elem(i,j);
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 os << "\n";
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1569 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1570 return os;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1571 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1572
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1573 std::istream&
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1574 operator >> (std::istream& is, FixedComplexMatrix& a)
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 int nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1577 int nc = a.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1578
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1579 if (nr < 1 || nc < 1)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1580 is.clear (std::ios::badbit);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1581 else
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 FixedPointComplex tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1584 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1585 for (int j = 0; j < nc; j++)
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 is >> tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1588 if (is)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1589 a.elem (i, j) = tmp;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1590 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1591 goto done;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1592 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1593 }
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 done:
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1596
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1597 return is;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1598 }
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 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1601 operator * (const FixedComplexMatrix& a, const FixedComplexMatrix& b)
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 FixedComplexMatrix retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1604
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1605 int a_nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1606 int a_nc = a.cols ();
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 int b_nr = b.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1609 int b_nc = b.cols ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1610
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1611 if (a_nc != b_nr)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1612 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
1613 else
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1614 {
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1615 retval.resize (dim_vector (a_nr, b_nc), FixedPointComplex());
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1616 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
1617 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1618 for (int j = 0; j < b_nr; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1619 for (int i = 0; i < b_nc; i++) {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1620 FixedPointComplex tmp = b.elem(j,i);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1621 for (int k = 0; k < a_nr; k++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1622 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
1623 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1624 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1625 }
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 return retval;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1628 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1629
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1630 // 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
1631 // functions below.
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1632
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1633 #define EMPTY_RETURN_CHECK(T) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1634 if (nr == 0 || nc == 0) \
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1635 return T (nr, nc);
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 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1638 min (FixedPointComplex d, const FixedComplexMatrix& m)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1639 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1640 int nr = m.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1641 int nc = m.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1642 FixedPoint dabs = ::abs(d);
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 EMPTY_RETURN_CHECK (FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1645
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1646 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1647
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1648 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1649 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1650 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1651 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1652 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
1653 }
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 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1656 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1657
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1658 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1659 min (const FixedComplexMatrix& m, FixedPointComplex d)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1660 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1661 int nr = m.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1662 int nc = m.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1663 FixedPoint dabs = ::abs(d);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1664
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1665 EMPTY_RETURN_CHECK (FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1666
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1667 FixedComplexMatrix result (nr, nc);
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 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1670 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1671 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1672 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1673 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
1674 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1675
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1676 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1677 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1678
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1679 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1680 min (const FixedComplexMatrix& a, const FixedComplexMatrix& b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1681 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1682 int nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1683 int nc = a.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1684
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1685 if (nr != b.rows () || nc != b.columns ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1686 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1687 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1688 ("two-arg min expecting args of same size");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1689 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1690 }
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 EMPTY_RETURN_CHECK (FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1693
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1694 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1695
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1696 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1697 for (int i = 0; i < nr; i++)
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 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1700 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
1701
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1702 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1703
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1704 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1705 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1706
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1707 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1708 max (FixedPointComplex d, const FixedComplexMatrix& m)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1709 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1710 int nr = m.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1711 int nc = m.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1712 FixedPoint dabs = ::abs(d);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1713
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1714 EMPTY_RETURN_CHECK (FixedComplexMatrix);
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 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1717
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1718 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1719 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1720 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1721 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1722 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
1723 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1724
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1725 return result;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1726 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1727
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1728 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1729 max (const FixedComplexMatrix& m, FixedPointComplex d)
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 int nr = m.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1732 int nc = m.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1733 FixedPoint dabs = ::abs(d);
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 EMPTY_RETURN_CHECK (FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1736
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1737 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1738
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1739 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1740 for (int i = 0; i < nr; i++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1741 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1742 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1743 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
1744 }
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 return result;
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
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1749 FixedComplexMatrix
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1750 max (const FixedComplexMatrix& a, const FixedComplexMatrix& b)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1751 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1752 int nr = a.rows ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1753 int nc = a.columns ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1754
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1755 if (nr != b.rows () || nc != b.columns ())
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1756 {
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1757 (*current_liboctave_error_handler)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1758 ("two-arg max expecting args of same size");
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1759 return FixedComplexMatrix ();
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1760 }
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 EMPTY_RETURN_CHECK (FixedComplexMatrix);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1763
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1764 FixedComplexMatrix result (nr, nc);
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1765
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1766 for (int j = 0; j < nc; j++)
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1767 for (int i = 0; i < nr; i++)
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 OCTAVE_QUIT;
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1770 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
1771 }
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1772
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1773 return result;
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
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1776 MS_CMP_OPS(FixedComplexMatrix, FixedPointComplex)
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1777 MS_BOOL_OPS(FixedComplexMatrix, FixedPointComplex)
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1778
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1779 SM_CMP_OPS(FixedPointComplex, FixedComplexMatrix)
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1780 SM_BOOL_OPS(FixedPointComplex, FixedComplexMatrix)
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1781
9481
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1782 MM_CMP_OPS(FixedComplexMatrix, FixedComplexMatrix)
d84d2fea3c90 Re-enable compilation of fixed package
jordigh
parents: 5660
diff changeset
1783 MM_BOOL_OPS(FixedComplexMatrix, FixedComplexMatrix)
2383
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1784
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 ;;; Local Variables: ***
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1787 ;;; mode: C++ ***
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1788 ;;; End: ***
d1930f8af7ca Changed the directory structure of fixed to match the package system
hauberg
parents:
diff changeset
1789 */