Line data Source code
1 : //# StokesUtil.cc: 2 : //# Copyright (C) 1996,1999 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 : #include <casacore/casa/aips.h> 29 : #include <synthesis/MeasurementEquations/StokesUtil.h> 30 : #include <casacore/casa/Arrays/IPosition.h> 31 : #include <casacore/casa/Arrays/Vector.h> 32 : #include <casacore/casa/Arrays/ArrayLogical.h> 33 : 34 : using namespace casacore; 35 : namespace casa { //# NAMESPACE CASA - BEGIN 36 : 37 0 : Array<StokesVector> operator* (const Array<Float> &farray, 38 : const StokesVector &sv){ 39 0 : Array<StokesVector> svarray(farray.shape()); 40 0 : uInt nelem = farray.nelements(); 41 0 : IPosition vsize(1,nelem); 42 0 : Vector<StokesVector> lsvarray(svarray.reform(vsize)); 43 0 : Vector<Float> lfarray(farray.reform(vsize)); 44 0 : for (uInt i = 0; i < nelem; i++){ 45 0 : lsvarray(i) = sv*lfarray(i); 46 : } 47 0 : return svarray; 48 : } 49 : 50 0 : Bool nearAbs(const StokesVector& val1, const StokesVector& val2, 51 : Double tol){ 52 0 : return allNearAbs(val1.vector(), val2.vector(), tol); 53 : } 54 : 55 0 : Bool near(const StokesVector& val1, const StokesVector& val2, 56 : Double tol){ 57 0 : return allNear(val1.vector(), val2.vector(), tol); 58 : } 59 : 60 : // define comparison operators on StokesVectors using their 61 : // length in 4-space 62 0 : Bool operator>(const StokesVector& left,const StokesVector& right){ 63 0 : if (innerProduct(left,left) > innerProduct(right, right)) 64 0 : return true; 65 : else 66 0 : return false; 67 : } 68 : 69 : 70 : } //# NAMESPACE CASA - END 71 :