casacore
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>
33 #include <casacore/casa/Arrays/Vector.h>
34 #include <casacore/casa/Arrays/Matrix.h>
35 #include <casacore/casa/BasicSL/Complex.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);
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>
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>
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>
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);
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>
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)
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 //
186 
187 //
188 // The real part of a product of a Complex Matrix and a Complex Matrix
189 //
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 
casacore::MatrixMath_global_functions_Linear_Algebra::norm1
Int norm1(const Matrix< Int > &A)
The one norm (or maximum value of the sum of the absolute values of the column members of a matrix)
casacore::MatrixMath_global_functions_Linear_Algebra::Rot3D
Matrix< T > Rot3D(Int axis, T angle)
Create a 3D rotation matrix (3x3).
casacore::Matrix
A 2-D Specialization of the Array class.
Definition: Array.h:50
Complexfwd_global_functions_Complexfwd::casacore::DComplex
std::complex< Double > DComplex
Definition: Complexfwd.h:50
casacore::MatrixMath_global_functions_Linear_Algebra::normI
Double normI(const Matrix< Double > &A)
casacore::MatrixMath_global_functions_Linear_Algebra::norm1
Double norm1(const Matrix< Double > &A)
casacore::MatrixMath_global_functions_Linear_Algebra::normI
Double normI(const Matrix< DComplex > &A)
casacore::MatrixMath_global_functions_Linear_Algebra::norm
Float norm(const Vector< Float > &x)
casacore::MatrixMath_global_functions_Linear_Algebra::innerProduct
DComplex innerProduct(const Vector< DComplex > &x, const Vector< DComplex > &y)
casacore::MatrixMath_global_functions_Linear_Algebra::normI
Int normI(const Matrix< Int > &A)
The infinity norm (or maximum value of the sum of the absolute values of the rows members of a matrix...
casacore::MatrixMath_global_functions_Linear_Algebra::Rot3D
Matrix< Double > Rot3D(Int axis, Double angle)
casacore::MatrixMath_global_functions_Linear_Algebra::norm
Int norm(const Vector< Int > &x)
The magnitude/norm of a vector.
casacore::MatrixMath_global_functions_Linear_Algebra::adjoint
Matrix< Float > adjoint(const Matrix< Float > &A)
casacore::MatrixMath_global_functions_Linear_Algebra::norm1
Float norm1(const Matrix< Float > &A)
casacore::Float
float Float
Definition: aipstype.h:54
casacore::MatrixMath_global_functions_Linear_Algebra::crossProduct2D
T crossProduct2D(const Vector< T > &x, const Vector< T > &y)
Magnitude of cross product of two 2-space vectors, x[0]*y[1] - x[1]*y[0].
casacore::MatrixMath_global_functions_Linear_Algebra::normI
Float normI(const Matrix< Float > &A)
casacore::Double
double Double
Definition: aipstype.h:55
casacore::MatrixMath_global_functions_Linear_Algebra::directProduct
Matrix< T > directProduct(const Matrix< T > &A, const Matrix< T > &B)
The direct product of two matrices.
casacore::MatrixMath_global_functions_Linear_Algebra::adjoint
Matrix< DComplex > adjoint(const Matrix< DComplex > &A)
casacore::MatrixMath_global_functions_Linear_Algebra::rproduct
Vector< Float > rproduct(const Matrix< Complex > &, const Vector< Complex > &)
The real part of a product of a Complex Matrix and a Complex Vector.
casacore::MatrixMath_global_functions_Linear_Algebra::adjoint
Matrix< Double > adjoint(const Matrix< Double > &A)
casacore::MatrixMath_global_functions_Linear_Algebra::Rot3D
Matrix< Float > Rot3D(Int axis, Float angle)
casacore::MatrixMath_global_functions_Linear_Algebra::directProduct
Vector< T > directProduct(const Vector< T > &x, const Vector< T > &y)
The direct product of two vectors.
casacore::Int
int Int
Definition: aipstype.h:50
casacore
this file contains all the compiler specific defines
Definition: mainpage.dox:28
casacore::MatrixMath_global_functions_Linear_Algebra::conjugate
Matrix< DComplex > conjugate(const Matrix< DComplex > &A)
The complex conjugate of the double precision complex matrix A.
casacore::MatrixMath_global_functions_Linear_Algebra::product
Matrix< T > product(const Vector< T > &x, const Matrix< T > &yT)
The matrix/outer product of a vector and a transposed vector.
casacore::MatrixMath_global_functions_Linear_Algebra::product
Vector< Complex > product(const Matrix< Complex > &, const Vector< Float > &)
The product of a Complex Matrix and a Real Vector.
casacore::MatrixMath_global_functions_Linear_Algebra::rproduct
Matrix< Float > rproduct(const Matrix< Complex > &, const Matrix< Complex > &)
The real part of a product of a Complex Matrix and a Complex Matrix.
casacore::MatrixMath_global_functions_Linear_Algebra::innerProduct
Complex innerProduct(const Vector< Complex > &x, const Vector< Complex > &y)
casacore::MatrixMath_global_functions_Linear_Algebra::conjugate
Matrix< Complex > conjugate(const Matrix< Complex > &A)
The complex conjugate of the complex matrix A.
casacore::MatrixMath_global_functions_Linear_Algebra::norm1
Float norm1(const Matrix< Complex > &A)
casacore::MatrixMath_global_functions_Linear_Algebra::innerProduct
T innerProduct(const Vector< T > &x, const Vector< T > &y)
The scalar/dot/inner product of two equal length vectors.
casacore::MatrixMath_global_functions_Linear_Algebra::product
Matrix< T > product(const Matrix< T > &A, const Matrix< T > &B)
The matrix multiplication or cayley product of an MxN matrix and an NxP matrix.
casacore::MatrixMath_global_functions_Linear_Algebra::normI
Float normI(const Matrix< Complex > &A)
casacore::MatrixMath_global_functions_Linear_Algebra::adjoint
Matrix< Int > adjoint(const Matrix< Int > &A)
define the adjoint operator as a plain old transpose when the Matrix is not complex valued.
casacore::MatrixMath_global_functions_Linear_Algebra::norm1
Double norm1(const Matrix< DComplex > &A)
casacore::MatrixMath_global_functions_Linear_Algebra::crossProduct
Vector< T > crossProduct(const Vector< T > &x, const Vector< T > &y)
The vector/cross product of two 3-space vectors.
casacore::MatrixMath_global_functions_Linear_Algebra::transpose
Matrix< T > transpose(const Matrix< T > &A)
The NxM transpose of an MxN matrix.
Complexfwd_global_functions_Complexfwd::casacore::Complex
std::complex< Float > Complex
Definition: Complexfwd.h:49
casacore::Vector
A 1-D Specialization of the Array class.
Definition: ArrayIO.h:45
casacore::MatrixMath_global_functions_Linear_Algebra::norm
Double norm(const Vector< Double > &x)
casacore::MatrixMath_global_functions_Linear_Algebra
Linear algebra functions on Vectors and Matrices.
Definition: MatrixMath.h:53
casacore::MatrixMath_global_functions_Linear_Algebra::norm
Float norm(const Vector< Complex > &x)
casacore::MatrixMath_global_functions_Linear_Algebra::adjoint
Matrix< Complex > adjoint(const Matrix< Complex > &A)
The conjugate/transpose or adjoint of the complex matrix A.
casacore::MatrixMath_global_functions_Linear_Algebra::norm
Double norm(const Vector< DComplex > &x)
casacore::MatrixMath_global_functions_Linear_Algebra::product
Vector< T > product(const Matrix< T > &A, const Vector< T > &x)
The vector/outer product of an MxN matrix and an N-length vector.