#define DllExport   __declspec( dllexport )

struct Solver {
	int n;
	taucs_ccs_matrix * matrix;
	void * factorization;
};

DllExport void * CreaterCholeskySolver(int n, int nnz, int *rowIndex, int *colIndex, double *value);
DllExport int FreeSolver(void * sp);
DllExport int Solve(void * sp, double *x, double *b);
DllExport double SolveEx(void * sp, double *x, int xIndex, double *b, int bIndex);

struct SymbolicSolver {
	int n;
	taucs_ccs_matrix * matrix;
	void * factorization;
	int  * perm;
	int  * invperm;
	double *tmp_b;
	double *tmp_x;
};

DllExport void * CreaterSymbolicSolver(int n, int nnz, int *rowIndex, int *colIndex, double *value);
DllExport void FreeSymbolicSolver(void * sp);
DllExport int NumericFactor(void *sp, int n, int nnz, int *rowIndex, int *colIndex, double *value);
DllExport void FreeNumericFactor(void *sp);
DllExport int NumericSolve(void * sp, double *x, double *b);

struct CGSolver {
	int n;
	taucs_ccs_matrix * matrix;
};

DllExport void * CreaterCGSolver(int n, int nnz, int *rowIndex, int *colIndex, double *value);
DllExport int FreeCGSolver(void * sp);
DllExport int SolveCG(void * sp, double *x, double *b);
