SGSolve
sgutilities.hpp
Go to the documentation of this file.
1 // This file is part of the SGSolve library for stochastic games
2 // Copyright (C) 2019 Benjamin A. Brooks
3 //
4 // SGSolve free software: you can redistribute it and/or modify it
5 // under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // SGSolve is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see
16 // <http://www.gnu.org/licenses/>.
17 //
18 // Benjamin A. Brooks
19 // ben@benjaminbrooks.net
20 // Chicago, IL
21 
22 #ifndef _SGUTILITIES_HPP
23 #define _SGUTILITIES_HPP
24 
25 #include "sgcommon.hpp"
30 int indexToVector(int index,
32  vector<int> & v,
33  const vector<int> & sizes);
34 
36 int vectorToIndex(const vector<int> & v,
37  const vector<int> & sizes);
38 
39 
40 #endif
vectorToIndex
int vectorToIndex(const vector< int > &v, const vector< int > &sizes)
Maps a multi-index into a linear index over an array with the given dimension.
Definition: sgutilities.cpp:47
indexToVector
int indexToVector(int index, vector< int > &v, const vector< int > &sizes)
Maps a linear index into a multi-index over an array with the given dimension.
Definition: sgutilities.cpp:25