//# MatrixMath.h: The Casacore linear algebra functions
//# Copyright (C) 1994,1995,1996,1999,2000,2002
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//# $Id$
#ifndef CASA_MATRIXMATH_2_H
#define CASA_MATRIXMATH_2_H
#include "Vector.h"
#include "Matrix.h"
namespace casacore { //# NAMESPACE CASACORE - BEGIN
//
// Linear algebra functions on Vectors and Matrices.
//
//
//
//
//
//
// Linear Algebra -- Linear algebra functions
// on Vectors and Matrices.
//
//
//
//
// The scalar/dot/inner product of two equal length vectors.
//
//
template T innerProduct (const Vector &x, const Vector &y);
std::complex innerProduct (const Vector> &x, const Vector> &y);
std::complex innerProduct (const Vector> &x, const Vector> &y);
//
//
// The magnitude/norm of a vector.
//
int norm (const Vector &x);
float norm (const Vector &x);
double norm (const Vector &x);
float norm (const Vector> &x);
double norm (const Vector> &x);
//
//
// The vector/cross product of two 3-space vectors.
//
template
Vector crossProduct (const Vector &x, const Vector &y);
// Magnitude of cross product of two 2-space vectors, x[0]*y[1] - x[1]*y[0].
template T crossProduct2D(const Vector &x, const Vector &y);
//
// The matrix/outer product of a vector and a transposed vector.
// The function's second argument is actually a transposed vector
// stored as the only row in a 1xN matrix.
//
template
Matrix product (const Vector &x, const Matrix &yT);
//
// The vector/outer product of an MxN matrix and an N-length vector.
//
template
Vector product (const Matrix &A, const Vector &x);
//
// The direct product of two vectors.
// The resulting vector contains for every element of x, the product of
// that element and Vector y. Thus the length of the output vector is
// the product of the input lengths.
//
template
Vector directProduct(const Vector& x, const Vector& y);
//
// The matrix multiplication or cayley product of an MxN matrix and
// an NxP matrix.
//
template
Matrix product (const Matrix &A, const Matrix &B);
//
// The infinity norm (or maximum value of the sum of the absolute values
// of the rows members of a matrix)
//
int normI(const Matrix &A);
float normI(const Matrix &A);
double normI(const Matrix &A);
float normI(const Matrix> &A);
double normI(const Matrix> &A);
//
//
// The one norm (or maximum value of the sum of the absolute values
// of the column members of a matrix)
//
int norm1(const Matrix &A);
float norm1(const Matrix &A);
double norm1(const Matrix &A);
float norm1(const Matrix> &A);
double norm1(const Matrix> &A);
//
//
// The NxM transpose of an MxN matrix.
//
template Matrix transpose (const Matrix &A);
// Create a 3D rotation matrix (3x3).
// Axis is 0,1,2 for x,y,z; angle is in radians.
//
template Matrix Rot3D(int axis, T angle);
Matrix Rot3D(int axis, double angle);
Matrix Rot3D(int axis, float angle);
//
//
// The direct product of two matrices.
// The resulting matrix contains for every element of A, the product of
// that element and Matrix B. Thus the shape of the output matrix is
// the (element by element) product of the input shapes.
//
template
Matrix directProduct(const Matrix& A, const Matrix& B);
//
// The conjugate/transpose or adjoint of the complex matrix A.
//
Matrix> adjoint (const Matrix> &A);
Matrix> adjoint (const Matrix> &A);
// define the adjoint operator as a plain old transpose when the Matrix is
// not complex valued. (for templating purposes)
Matrix adjoint (const Matrix &A);
Matrix adjoint (const Matrix &A);
Matrix adjoint (const Matrix &A);
//
// The product of a std::complex Matrix and a Real Vector
//
Vector> product(const Matrix>&, const Vector&);
//
// The real part of a product of a std::complex Matrix and a std::complex Vector
//
Vector rproduct(const Matrix>&, const Vector>&);
//
// The real part of a product of a std::complex Matrix and a std::complex Matrix
//
Matrix rproduct (const Matrix>&, const Matrix>&);
//
} //# NAMESPACE CASACORE - END
#include "MatrixMath.tcc"
#endif