#line 1 "/user/cvsspst/ees1cg/RAVL/RAVL-0.7/Math/LinearAlgebra/FixedSize/FVectorMatrix.hh" // This file is part of RAVL, Recognition And Vision Library // Copyright (C) 2001, University of Surrey // This code may be redistributed under the terms of the GNU Lesser // General Public License (LGPL). See the lgpl.licence file for details or // see http://www.gnu.org/copyleft/lesser.html // file-header-ends-here #ifndef RAVL_FVECTORMATRIX_HEADER #define RAVL_FVECTORMATRIX_HEADER 1 //! rcsid=$Id: FVectorMatrix.hh,v 1.2 2002/08/08 16:03:19 craftit Exp $ //! author="Charles Galambos" //! date="13/04/2002" //! docentry="Ravl.Math.Geometry" //! lib=RavlMath //! file="Ravl/Math/LinearAlgebra/FixedSize/FVectorMatrix.hh" #include "Ravl/FVector.hh" #include "Ravl/FMatrix.hh" namespace RavlN { template class FVectorMatrixC : protected FVectorC, protected FMatrixC { public: FVectorMatrixC() {} //: Default constructor. FVectorMatrixC(const FVectorC &vec,const FMatrixC &mat) : FVectorC(vec), FMatrixC(mat) {} //: Construct from a vector and a matrix. FVectorC & Vector() { return *this; } //: Access to the vector. FMatrixC & Matrix() { return *this; } //: Access to the matrix. const FVectorC & Vector() const { return *this; } //: Access to the vector. const FMatrixC & Matrix() const { return *this; } //: Access to the matrix. void Fill(RealT value) { FMatrixC::Fill(value); FVectorC::Fill(value); } //: Fills both the vector and matrix with 'value' void Sort(); //: Sort in place according to the vector value. // The first value will be the biggest one. }; template void FVectorMatrixC::Sort() { const UIntT vn = Vector().Size(); for (UIntT i=0; i maxValue) maxValue = Vector()[maxIndex=j]; if (maxIndex != i) { // Swap columns of the matrices and items of the vector. Vector()[maxIndex]=Vector()[i]; Vector()[i]=maxValue; for (UIntT j=0; j