casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MatrixMath.h
Go to the documentation of this file.
1 //# MatrixMath.h: The Casacore linear algebra functions
2 //# Copyright (C) 1994,1995,1996,1999,2000,2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef CASA_MATRIXMATH_H
29 #define CASA_MATRIXMATH_H
30 
31 
32 #include <casacore/casa/aips.h>
36 
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //<summary>
41 // Linear algebra functions on Vectors and Matrices.
42 // </summary>
43 //
44 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tLinAlgebra">
45 //</reviewed>
46 //
47 // <linkfrom anchor="Linear Algebra" classes="Vector Matrix">
48 // <here>Linear Algebra</here> -- Linear algebra functions
49 // on Vectors and Matrices.
50 // </linkfrom>
51 //
52 //<group name="Linear Algebra">
53 
54 //
55 // The scalar/dot/inner product of two equal length vectors.
56 //
57 //<group>
58 template <class T> T innerProduct (const Vector<T> &x, const Vector<T> &y);
61 //</group>
62 
63 //
64 // The magnitude/norm of a vector.
65 //<group>
66 Int norm (const Vector<Int> &x);
67 Float norm (const Vector<Float> &x);
68 Double norm (const Vector<Double> &x);
69 Float norm (const Vector<Complex> &x);
70 Double norm (const Vector<DComplex> &x);
71 //</group>
72 
73 //
74 // The vector/cross product of two 3-space vectors.
75 //
76 template <class T>
77  Vector<T> crossProduct (const Vector<T> &x, const Vector<T> &y);
78 
79 // Magnitude of cross product of two 2-space vectors, x[0]*y[1] - x[1]*y[0].
80 template <class T> T crossProduct2D(const Vector<T> &x, const Vector<T> &y);
81 //
82 // The matrix/outer product of a vector and a transposed vector.
83 // <note> The function's second argument is actually a transposed vector
84 // stored as the only row in a 1xN matrix. </note>
85 //
86 template <class T>
87  Matrix<T> product (const Vector<T> &x, const Matrix<T> &yT);
88 
89 //
90 // The vector/outer product of an MxN matrix and an N-length vector.
91 //
92 template <class T>
93  Vector<T> product (const Matrix<T> &A, const Vector<T> &x);
94 
95 //
96 // The direct product of two vectors.
97 // The resulting vector contains for every element of x, the product of
98 // that element and Vector y. Thus the length of the output vector is
99 // the product of the input lengths.
100 //
101 template <class T>
102  Vector<T> directProduct(const Vector<T>& x, const Vector<T>& y);
103 
104 //
105 // The matrix multiplication or cayley product of an MxN matrix and
106 // an NxP matrix.
107 //
108 template <class T>
109  Matrix<T> product (const Matrix<T> &A, const Matrix<T> &B);
110 
111 //
112 // The infinity norm (or maximum value of the sum of the absolute values
113 // of the rows members of a matrix)
114 // <group>
115 Int normI(const Matrix<Int> &A);
116 Float normI(const Matrix<Float> &A);
117 Double normI(const Matrix<Double> &A);
118 Float normI(const Matrix<Complex> &A);
119 Double normI(const Matrix<DComplex> &A);
120 // </group>
121 
122 //
123 // The one norm (or maximum value of the sum of the absolute values
124 // of the column members of a matrix)
125 //<group>
126 Int norm1(const Matrix<Int> &A);
127 Float norm1(const Matrix<Float> &A);
128 Double norm1(const Matrix<Double> &A);
129 Float norm1(const Matrix<Complex> &A);
130 Double norm1(const Matrix<DComplex> &A);
131 //</group>
132 
133 //
134 // The NxM transpose of an MxN matrix.
135 //
136 template <class T> Matrix<T> transpose (const Matrix<T> &A);
137 
138 // Create a 3D rotation matrix (3x3).
139 // Axis is 0,1,2 for x,y,z; angle is in radians.
140 // <group>
141 template <class T> Matrix<T> Rot3D(Int axis, T angle);
142 Matrix<Double> Rot3D(Int axis, Double angle);
143 Matrix<Float> Rot3D(Int axis, Float angle);
144 // </group>
145 
146 //
147 // The direct product of two matrices.
148 // The resulting matrix contains for every element of A, the product of
149 // that element and Matrix B. Thus the shape of the output matrix is
150 // the (element by element) product of the input shapes.
151 //
152 template <class T>
153  Matrix<T> directProduct(const Matrix<T>& A, const Matrix<T>& B);
154 
155 //
156 // The complex conjugate of the complex matrix A.
157 //
159 
160 //
161 // The complex conjugate of the double precision complex matrix A.
162 //
164 
165 //
166 // The conjugate/transpose or adjoint of the complex matrix A.
167 //
170 
171 // define the adjoint operator as a plain old transpose when the Matrix is
172 // not complex valued. (for templating purposes)
173 Matrix<Int> adjoint (const Matrix<Int> &A);
176 
177 //
178 // The product of a Complex Matrix and a Real Vector
179 //
181 
182 //
183 // The real part of a product of a Complex Matrix and a Complex Vector
184 //
185  Vector<Float> rproduct(const Matrix<Complex>&, const Vector<Complex>&);
186 
187 //
188 // The real part of a product of a Complex Matrix and a Complex Matrix
189 //
190  Matrix<Float> rproduct (const Matrix<Complex>&, const Matrix<Complex>&);
191 
192 // </group>
193 
194 
195 } //# NAMESPACE CASACORE - END
196 
197 #ifndef CASACORE_NO_AUTO_TEMPLATES
198 #include <casacore/casa/Arrays/MatrixMath.tcc>
199 #endif //# CASACORE_NO_AUTO_TEMPLATES
200 #endif
201 
A 1-D Specialization of the Array class.
int Int
Definition: aipstype.h:50
TableExprNode transpose(const TableExprNode &array)
Transpose all axes of a (masked) array.
Definition: ExprNode.h:1913
TableVector< T > crossProduct(const TableVector< T > &l, const TableVector< T > &r)
Definition: TabVecMath.h:417
A 2-D Specialization of the Array class.
T innerProduct(const TableVector< T > &l, const TableVector< T > &r)
Definition: TabVecMath.h:411
Matrix< casacore::Complex > adjoint(const casacore::Matrix< casacore::Complex > &A)
The conjugate/transpose or adjoint of the complex matrix A.
casacore::Matrix< T > Rot3D(casacore::Int axis, T angle)
Create a 3D rotation matrix (3x3).
double Double
Definition: aipstype.h:55
TableExprNode product(const TableExprNode &array)
Definition: ExprNode.h:1607
float Float
Definition: aipstype.h:54
Matrix< casacore::Complex > conjugate(const casacore::Matrix< casacore::Complex > &A)
complex space function specifications
TableExprNode norm(const TableExprNode &node)
Definition: ExprNode.h:1317
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42