casa
$Rev:20696$
|
00001 //# LUdecomp.h: LU matrix decomposition 00002 //# Copyright (C) 1994,1995,1999 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 NRAO_LUDECOMP_H 00029 #define NRAO_LUDECOMP_H 00030 00031 //# Includes 00032 #include <casa/aips.h> 00033 #include <casa/Containers/Block.h> 00034 #include <casa/Arrays/Matrix.h> 00035 00036 #define AIPS_ARRAY_INDEX_CHECK 00037 00038 // On suns, at least, this needs to link with: lapack.a blas.a 00039 // Since this links fortran libraries, check also whether "underscores" 00040 // are needed for FORTRAN on your machine, and whether a FORTRAN MAIN is 00041 // needed to initialize the fortran libraries (as it is on suns). 00042 00043 // This is needed on Sun machines, likely not on IBM. Should be set in 00044 // makedefs. 00045 00046 // LUdecomp objects are a 2-D template matrix of numeric type which 00047 // contains (in packed form) a Lower Triangular (L) and Upper Triangular (U) 00048 // factorization of some numeric type matrix (A) and a block of integer type 00049 // which contains (in packed form) the Permutation Matrix (P), i.e. A=PLU. 00050 // The data members are filled by the LUdecomp constructors calling LAPACK's 00051 // Fortran xGETRF subroutine. 00052 00053 template<class T> class LUdecomp 00054 { 00055 public: 00056 LUdecomp<T>(); // 0-length Matrices 00057 LUdecomp<T>(Matrix<T> &); 00058 LUdecomp<T>(const LUdecomp<T> &); 00059 // The copy constructor uses reference semantics. 00060 00061 Matrix<T> getUpper() const; 00062 Matrix<T> getLower() const; 00063 Matrix<T> getPerm() const; 00064 00065 Matrix<T> getLU() const {return LU.copy();} 00066 Block<Int> getPivot() const {return thePivot;} 00067 00068 private: 00069 Matrix<T> LU; 00070 Block<Int> thePivot; 00071 }; 00072 00073 #endif