/* 
 * PDF Estimator:  A non-parametric probability density estimation tool based on maximum entropy
 * File:   JointProbability.cpp
 * Copyright (C) 2018
 * Jenny Farmer jfarmer6@uncc.edu
 * Donald Jacobs djacobs1@uncc.edu
 * 
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 */


#ifndef JOINTPROBABILITY_H
#define JOINTPROBABILITY_H

#include <vector>
#include "Variable.h"
#include "OutputControl.h"
#include <math.h>

class JointProbability {
public:
    JointProbability(vector <Variable> variables, int nSamples, int pdfSize);
    virtual ~JointProbability();    
        
    OutputControl out;
    void calculate();
//    vector <vector <double > > getRange();
    vector <double> getRange();
    vector <double> getJP();
private:
    vector <Variable> variables;
    double * jointPDF;
    int nSamples;
    int gridSize;
    int pdfSize;
    int nVariables;
    int matrixSize;
    vector < vector < int > > grids;        
    
    vector <double> gridPointsCourse;
    vector <double> gridPointsFine;
        
    vector <int> rowsIntersect(vector <int> v1, vector <int> v2);
    
};

#endif /* JOINTPROBABILITY_H */

