MatrixMath.h

Go to the documentation of this file.
00001 //# MatrixMath.h: The Casacore linear algebra functions
00002 //# Copyright (C) 1994,1995,1996,1999,2000,2002
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef CASA_MATRIXMATH_H
00029 #define CASA_MATRIXMATH_H
00030 
00031 
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/casa/Arrays/Vector.h>
00034 #include <casacore/casa/Arrays/Matrix.h>
00035 #include <casacore/casa/BasicSL/Complex.h>
00036 
00037 
00038 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00039 
00040 //<summary>
00041 //    Linear algebra functions on Vectors and Matrices.
00042 // </summary>
00043 //
00044 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tLinAlgebra">
00045 //</reviewed>
00046 //
00047 // <linkfrom anchor="Linear Algebra" classes="Vector Matrix">
00048 //    <here>Linear Algebra</here> -- Linear algebra functions
00049 //     on Vectors and Matrices.
00050 // </linkfrom>
00051 //
00052 //<group name="Linear Algebra">
00053 
00054 //
00055 // The scalar/dot/inner product of two equal length vectors.
00056 //
00057 //<group>
00058 template <class T> T innerProduct (const Vector<T> &x, const Vector<T> &y);
00059 Complex innerProduct (const Vector<Complex> &x, const Vector<Complex> &y);
00060 DComplex innerProduct (const Vector<DComplex> &x, const Vector<DComplex> &y);
00061 //</group>
00062 
00063 //
00064 // The magnitude/norm of a vector.
00065 //<group>
00066 Int norm (const Vector<Int> &x);
00067 Float norm (const Vector<Float> &x);
00068 Double norm (const Vector<Double> &x);
00069 Float norm (const Vector<Complex> &x);
00070 Double norm (const Vector<DComplex> &x);
00071 //</group>
00072 
00073 //
00074 // The vector/cross product of two 3-space vectors.
00075 //
00076 template <class T> 
00077    Vector<T> crossProduct (const Vector<T> &x, const Vector<T> &y);
00078 
00079 // Magnitude of cross product of two 2-space vectors, x[0]*y[1] - x[1]*y[0]. 
00080 template <class T> T crossProduct2D(const Vector<T> &x, const Vector<T> &y);
00081 //
00082 // The matrix/outer product of a vector and a transposed vector. 
00083 // <note> The function's second argument is actually a transposed vector
00084 // stored as the only row in a 1xN matrix. </note>
00085 //
00086 template <class T>
00087    Matrix<T> product (const Vector<T> &x, const Matrix<T> &yT);
00088 
00089 //
00090 // The vector/outer product of an MxN matrix and an N-length vector.
00091 //
00092 template <class T>
00093    Vector<T> product (const Matrix<T> &A, const Vector<T> &x);
00094 
00095 // 
00096 // The direct product of two vectors.
00097 // The resulting vector contains for every element of x, the product of
00098 // that element and Vector y. Thus the length of the output vector is
00099 // the product of the input lengths.
00100 //
00101 template <class T> 
00102    Vector<T> directProduct(const Vector<T>& x, const Vector<T>& y);
00103 
00104 //
00105 // The matrix multiplication or cayley product of an MxN matrix and
00106 // an NxP matrix.
00107 //
00108 template <class T> 
00109    Matrix<T> product (const Matrix<T> &A, const Matrix<T> &B);
00110 
00111 //
00112 // The infinity norm (or maximum value of the sum of the absolute values 
00113 // of the rows members of a matrix)
00114 // <group>
00115 Int normI(const Matrix<Int> &A);
00116 Float normI(const Matrix<Float> &A);
00117 Double normI(const Matrix<Double> &A);
00118 Float normI(const Matrix<Complex> &A);
00119 Double normI(const Matrix<DComplex> &A);
00120 // </group>
00121 
00122 //
00123 // The one norm (or maximum value of the sum of the absolute values 
00124 // of the column members of a matrix)
00125 //<group>
00126 Int norm1(const Matrix<Int> &A);
00127 Float norm1(const Matrix<Float> &A);
00128 Double norm1(const Matrix<Double> &A);
00129 Float norm1(const Matrix<Complex> &A);
00130 Double norm1(const Matrix<DComplex> &A);
00131 //</group>
00132 
00133 //
00134 // The NxM transpose of an MxN matrix.
00135 //
00136 template <class T> Matrix<T> transpose (const Matrix<T> &A);
00137 
00138 // Create a 3D rotation matrix (3x3).
00139 // Axis is 0,1,2 for x,y,z; angle is in radians.
00140 // <group>
00141 template <class T> Matrix<T> Rot3D(Int axis, T angle);
00142 Matrix<Double> Rot3D(Int axis, Double angle);
00143 Matrix<Float> Rot3D(Int axis, Float angle);
00144 // </group>
00145 
00146 // 
00147 // The direct product of two matrices.
00148 // The resulting matrix contains for every element of A, the product of
00149 // that element and Matrix B. Thus the shape of the output matrix is
00150 // the (element by element) product of the input shapes.
00151 //
00152 template <class T> 
00153    Matrix<T> directProduct(const Matrix<T>& A, const Matrix<T>& B);
00154 
00155 //
00156 // The complex conjugate of the complex matrix A.
00157 //
00158 Matrix<Complex> conjugate (const Matrix<Complex> &A);
00159 
00160 //
00161 // The complex conjugate of the double precision complex matrix A.
00162 //
00163 Matrix<DComplex> conjugate (const Matrix<DComplex> &A);
00164 
00165 //
00166 // The conjugate/transpose or adjoint of the complex matrix A.
00167 //
00168 Matrix<Complex> adjoint (const Matrix<Complex> &A);
00169 Matrix<DComplex> adjoint (const Matrix<DComplex> &A);
00170 
00171 // define the adjoint operator as a plain old transpose when the Matrix is 
00172 // not complex valued. (for templating purposes)
00173 Matrix<Int> adjoint (const Matrix<Int> &A);
00174 Matrix<Float> adjoint (const Matrix<Float> &A);
00175 Matrix<Double> adjoint (const Matrix<Double> &A);
00176 
00177 //
00178 // The product of a Complex Matrix and a Real Vector
00179 //
00180   Vector<Complex> product(const Matrix<Complex>&, const Vector<Float>&);
00181 
00182 //
00183 // The real part of a product of a Complex Matrix and a Complex Vector
00184 //
00185   Vector<Float> rproduct(const Matrix<Complex>&, const Vector<Complex>&);
00186 
00187 //
00188 // The real part of a product of a Complex Matrix and a Complex Matrix
00189 //
00190   Matrix<Float> rproduct (const Matrix<Complex>&, const Matrix<Complex>&);
00191 
00192 // </group>
00193 
00194 
00195 } //# NAMESPACE CASACORE - END
00196 
00197 #ifndef CASACORE_NO_AUTO_TEMPLATES
00198 #include <casacore/casa/Arrays/MatrixMath.tcc>
00199 #endif //# CASACORE_NO_AUTO_TEMPLATES
00200 #endif
00201 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1