src/qvmath/qvtensorindex.cpp

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00024 
00025 #include <qvmath/qvtensorindex.h>
00026 
00027 int QVTensorIndex::nextIndexId = 2;
00028 
00029 std::ostream& operator<<( std::ostream &os, const QVTensorIndex &tensorIndex)
00030         {
00031         os << ((tensorIndex.id<0)?"cov ":"") << tensorIndex.dim;
00032         return os;
00033         }
00034 
00035 QMap<int, QVector<int> > QVTensorIndexValues::getIndexesValues() const
00036         {
00037         QMap<int, QVector<int> > result;
00038         for (int i = 0; i < size(); i++)
00039                 for (int j = at(i).rangeMin; j <= at(i).rangeMax; j++)
00040                         result[ABS(at(i).id)].append(j);
00041 
00042         return result;
00043         }
00044 
00045 QMap<int, QVector<int> > QVTensorValence::getIndexesPositions() const
00046         {
00047         QMap<int, QVector<int> > result;
00048         for (int i = 0, position = 0; i < size(); i++)
00049                 result[ABS(at(i).id)].append(position++);
00050 
00051         return result;
00052         }
00053 

Generated on Thu Jul 17 17:23:28 2008 for QVision by  doxygen 1.5.3