#include<QThread>
//
//##############################################################################
//                          ThreadedMatrixMult.h
//
// ThreadedMatrixMult is a class that extends QThread and implemenents a 
// matrix multiplcation operation within the run() method. 
//
// The run() method can be invoked by either calling start(), which causes the run() 
// routine to be executed in a separate thread, or by calling run(() directly which causes
// the routine to be executed in the current thread. 
//
// When run() is executed in a separate thread, the stop() method can be called
// by code executing in another thread. The stop() routine sets the member variable 
// haltFlag, which induces the run() routine to halt computation and return. 
//
// The terminate() member function is not used to stop the execution.  
//
// Math 157   March, 11, 2009                                         (C) UCLA  
//##############################################################################
//
#ifndef _ThreadedMatrixMult_
#define _ThreadedMatrixMult_

class ThreadedMatrixMult : public QThread
{
	public:
	
	ThreadedMatrixMult();
	virtual ~ThreadedMatrixMult();
	
	void setMatrixSize(long matrixSize);
	
	public:
		
    void run();
    void stop();
    
    private :
    
    void destroyData();

    long N;         // Matrix size
    
    double* aData;  // data for matrices
    double* bData;  
    double* cData;  
    
    double** A;     // data for matrix row pointers
    double** B;   
    double** C;
    
    private :
    
    bool haltFlag;
 };


#endif 
