autoDoc/HTML/---libInvertedFile-include-CMatrixWithEigenVectors-h

    /* -*- mode: c++ -*-
    */
    /*

        GIFT, a flexible content based image retrieval system.
        Copyright (C) 1998, 1999, 2000 CUI, University of Geneva

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        This program 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 General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    */
    // -*- mode: c++ -*-
    #ifndef _CMATRIXWITHEIGENVECTORS
    #define _CMATRIXWITHEIGENVECTORS

    #include "CMatrix.h"
    /**
       A CMatrix with a CMatrix of eigenvectors in it.
       The goal of this is to pick the "best" eigenvector
       with respect to our matrix of mutual trust.

       Algorithm for calculating eigenvectors comes from
       numerical recipes.

       define:_CMATRIXWITHEIGENVECTORS_TEST to get a test program with it (main)
     */
    class CMatrixWithEigenVectors.html">CMatrixWithEigenVectors:public CMatrix{
      /** are the eigenvectors of this current? */
      bool mIsCurrentEigenVectors;
      /** the eigenvectors of this matrix */
      CMatrix* mEigenVectors;
      /** */
      vector<float> mEigenValues;
      /** the number of jacobi rotations */
      int mNumberOfRotations;
    public:
      /** */
      CMatrixWithEigenVectors(int inSize);
      /**
         Calculate the eigenvectors for this matrix and store them
         in mEigenValues; The corresponding Eigenvectors go to
         mEigenVectors.

         Algorithm taken from numerical recipes
         kept semantics intact, but tried to do about
         everything differently.
         (pages 463-469 "Numerical recipes in C", 2nd edition)

         Parameter is the size of the upper left submatrix
         for which the eigenvectors are calculated.
         mEigenvectors will have this size as well as mEigenValues
      */
      void calculateEigenVectors(int inSize);
      /**
          calls calculateEigenVectors(mSize)
       */
      void calculateEigenVectors();

      /** get a reference to the eigenvectors */
      const CMatrix& getEigenVectors()const;
      /** get a reference to the eigenvectors */
      const vector<float>& getEigenValues()const;
      /** generating diagnostic output:
          Matrix and its Eigenvectors*/
      friend ostream& operator<<(ostream& outStream,
    			     const CMatrixWithEigenVectors& inMatrix);

    };

    ostream& operator<<(ostream& outStream,
    		    const CMatrixWithEigenVectors& inMatrix);
    #endif