#include <mexhelper.h>
#include <lineq.ci>

int main (int argc, char **argv)
{
	ctl::vector<ctl::location> loc = ctl::readLocation("rsc.txt");
	if (loc.size() < 1)
	{
		std::cerr << "No valid location found.\n";
		return 1;
	}
	ctl::link lnk(loc[0]);

	try
	{
		LinEq::use(lnk);
		
		double data[] = {4, 1, 0, 1, 4, 1, 0, 1, 4};
		matrix<double> A(3, 3, data);
		myVector<double> b(3);
		for (int i=0;i<b.size();i++)
			b[i] = 0.5;

		std::cout << (myVector<double>)LinEq::solve<double>(A, b) << "\n";
	}
	catch (ctl::exception &e)
	{
		std::cerr << e << "\n";
	}
	return 0;
}
