///home/berryj/link/bin/genMethods "-g" "-t" "double" "-h" "Matrix" "-I" "LINK/basic/Matrix.h" "-d" "basic" 
#include <stk.h>
#include <LINK/stkWrapper/LINK_STk.h>

#include <LINK/basic/Matrix.h>

#include <LINK/stkWrapper/Wrapper.h>
#include <LINK/stkWrapper/Register.h>
#include <LINK/stkWrapper/MatrixWrapper.h>


typedef double _double;
typedef Matrix<double > _Matrix_double_;
static Matrix<double > s__Matrix_double_;

#define _Matrix_double_DATA(x) ((Matrix<double >*) (EXTDATA(x)))
#define _Matrix_double_IS_DATA(x) (TYPEP(x, tc_CXXwrapper) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Matrix<double > >::type))
#define _Matrix_double_ISNT_DATA(x) (!_Matrix_double_IS_DATA(x))

#define _Matrix_double_CXX_DATA(x) (*(Matrix<double >*) (EXTDATA(VAL(x))))
#define _Matrix_double_CXX_IS_DATA(x) (INSTANCEP(x) && \
		TYPEP(STk_slot_ref(x,val_scm), tc_CXXwrapper) && \
		(EXTID(STk_slot_ref(x,val_scm)) == Wrapper<Matrix<double > >::type))
#define _Matrix_double_CXX_ISNT_DATA(x) (!_Matrix_double_CXX_IS_DATA(x))


PRIMITIVE STk_init__Matrix_double_()
{
	Wrapper<_Matrix_double_>::type = STk_new_CXXwrapper_id(
			Wrapper<_Matrix_double_>::name, 
			"",
			(void (*)(SCM x, SCM port, int mode))
			MatrixWrapper<_double>::displayTypedMatrix,
			(void (*)(SCM x))MatrixWrapper<_double>::markTypedMatrix,
			(void (*)(SCM x))MatrixWrapper<_double>::freeTypedMatrix);
	Tcl_InitHashTable(&Register<_Matrix_double_>::objTable, TCL_ONE_WORD_KEYS);
	return UNDEFINED;
}

void genExtra_Matrix_double_Methods(void);

PRIMITIVE STk_init_methods__Matrix_double_()
{
	STk_add_new_cpp_primitive("Matrix-double-make", tc_subr_2, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::makeLinkMatrix);
	STk_add_new_cpp_primitive("Matrix-double-make2", tc_subr_3, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::makeFilledLinkMatrix);
	STk_add_new_cpp_primitive("Matrix-double-matrix-ref", tc_subr_3, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::refLinkMatrix);
	STk_add_new_cpp_primitive("Matrix-double?", tc_subr_1, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::linkMatrixP);
	STk_add_new_cpp_primitive("matrix-double", tc_subr_2, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::makeLinkMatrix);
	STk_add_new_cpp_primitive("Matrix-double-matrix-fill!", tc_subr_2, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::fillLinkMatrix);
	STk_add_new_cpp_primitive("Matrix-double-matrix-copy", tc_subr_1, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::copyLinkMatrix);
	STk_add_new_cpp_primitive("Matrix-double-matrix-set!", tc_lsubr, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::setLinkMatrix);
	STk_add_new_cpp_primitive("Matrix-double-matrix-rows", tc_subr_1, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::numRowsLinkMatrix);
	STk_add_new_cpp_primitive("Matrix-double-matrix-cols", tc_subr_1, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::numColsLinkMatrix);
	STk_add_new_cpp_primitive("Matrix-double-eqv?", tc_subr_2, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::eqvLinkMatrix);
	STk_add_new_cpp_primitive("Matrix-double-multiply", tc_subr_2, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::multiply);
	STk_add_new_cpp_primitive("Matrix-double-sum", tc_subr_2, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::sum);
	STk_add_new_cpp_primitive("Matrix-double-transpose", tc_subr_1, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::transpose);
	STk_add_new_cpp_primitive("Matrix-double-add-rows", tc_subr_3, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::addRows);
	STk_add_new_cpp_primitive("Matrix-double-add-cols", tc_subr_3, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::addCols);
	STk_add_new_cpp_primitive("Matrix-double-swap-rows", tc_subr_3, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::swapRows);
	STk_add_new_cpp_primitive("Matrix-double-swap-cols", tc_subr_3, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::swapCols);
	STk_add_new_cpp_primitive("Matrix-double-scalar-mult-row", tc_subr_3, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::scalarMultRow);
	STk_add_new_cpp_primitive("Matrix-double-scalar-mult-col", tc_subr_3, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::scalarMultCol);
	STk_add_new_cpp_primitive("list->Matrix-double", tc_subr_1, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::stkList2LinkMatrix);
	STk_add_new_cpp_primitive("Matrix-double->list", tc_subr_1, 
	(PRIMITIVE (*)(...))  MatrixWrapper<_double>::linkMatrix2STkList);

	addOneArgMethod("matrix-copy",
		Wrapper<_Matrix_double_ >::name, 
		"Matrix-double-matrix-copy", LINK_OVL);
	addOneArgMethod("matrix-rows",
		Wrapper<_Matrix_double_ >::name, 
		"Matrix-double-matrix-rows", LINK_OVL);
	addOneArgMethod("matrix-cols",
		Wrapper<_Matrix_double_ >::name, 
		"Matrix-double-matrix-cols", LINK_OVL);
	addOneArgMethod("transpose",
		Wrapper<_Matrix_double_ >::name, 
		"Matrix-double-transpose", LINK_OVL);
	addThreeArgMethod("matrix-ref",
		Wrapper<_Matrix_double_ >::name, 
		"<integer>",
		"<integer>",
		"Matrix-double-matrix-ref", LINK_OVL);
	addTwoArgMethod("matrix-fill!",
		Wrapper<_Matrix_double_ >::name, 
		"<number>",
		"Matrix-double-matrix-fill!", LINK_OVL);
	addFourArgMethod("matrix-set!",
		Wrapper<_Matrix_double_ >::name, 
		"<integer>",
		"<integer>",
		"<number>",
		"Matrix-double-matrix-set!", LINK_OVL);
	addTwoArgMethod("eqv?",
		Wrapper<_Matrix_double_ >::name, 
		Wrapper<_Matrix_double_ >::name, 
		"Matrix-double-eqv?", LINK_OVL);
	addThreeArgMethod("add-rows",
		Wrapper<_Matrix_double_ >::name, 
		"<integer>",
		"<integer>",
		"Matrix-double-add-rows", LINK_OVL);
	addThreeArgMethod("add-cols",
		Wrapper<_Matrix_double_ >::name, 
		"<integer>",
		"<integer>",
		"Matrix-double-add-cols", LINK_OVL);
	addThreeArgMethod("swap-rows",
		Wrapper<_Matrix_double_ >::name, 
		"<integer>",
		"<integer>",
		"Matrix-double-swap-rows", LINK_OVL);
	addThreeArgMethod("swap-cols",
		Wrapper<_Matrix_double_ >::name, 
		"<integer>",
		"<integer>",
		"Matrix-double-swap-cols", LINK_OVL);
	addThreeArgMethod("scalar-mult-row",
		Wrapper<_Matrix_double_ >::name, 
		"<integer>",
		"<number>",
		"Matrix-double-scalar-mult-row", LINK_OVL);
	addThreeArgMethod("scalar-mult-col",
		Wrapper<_Matrix_double_ >::name, 
		"<integer>",
		"<number>",
		"Matrix-double-scalar-mult-col", LINK_OVL);
	genExtra_Matrix_double_Methods();
	return UNDEFINED;
}
