autoDoc/HTML/---libInvertedFile-include-CMatrix-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 _CMATRIX
    #define _CMATRIX
    #include <assert.h>
    #include <cmath>
    #include <iostream>
    #include <iomanip>
    #include <vector>
    #include <algorithm>
    #include <functional>

    /** a simple and fast matrix class */
    class CMatrix:public vector<vector<float> >{
    protected:
      /** the size of this matrix */
      int mSize;

    public:
      /** constructor */
      CMatrix(int inSize,float inDiagonal=1);
      /** get the diagonal of this */
      void getDiagonal(vector<float>& outDiagonal)const;
      /** the sum of off diagonal objects */
      float getOffDiagonalSum()const;
      /**
          putting the lower triangle into the upper
       */
      void symmetrify();
      /**
          transpose the matrix:
          this is useful for having the eigenvectors in the lines of
          the matrix
       */
      void transpose();
      /** this function is interesting for what we want to do with this
          matrix later. We move simply all elements one up, one left.
          Instead of the elements which were on the righter-lower rim we
          put zeros */
      void moveLeftUp();
    };

    /** Output a vector: Simply a space separated sequence of numbers */
    ostream& operator<<(ostream& outStream,
    		    const vector<float>& inVector);

    /** Output a matrix: Simply output a vector per line */
    ostream& operator<<(ostream& outStream,
    		    const CMatrix& inMatrix);

    #endif