TCAPIEXPORT tc_matrix tc_steadyStateScan(const char * param, double start, double end, int numSteps) { if (_tc_steadyStateScan) return _tc_steadyStateScan(param, start, end, numSteps); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_getSteadyState() { if (_tc_getSteadyState) return _tc_getSteadyState(); return tc_createMatrix(0,0); }
*/ TCAPIEXPORT tc_matrix tc_getNumbers(tc_strings labels) { if (_tc_getNumbers) return _tc_getNumbers(labels); return tc_createMatrix(0,0); }
*/ TCAPIEXPORT tc_matrix tc_getStoichiometry(tc_items A) { if (_tc_getStoichiometry) return _tc_getStoichiometry(A); return tc_createMatrix(0,0); }
*/ TCAPIEXPORT tc_matrix tc_getPos(tc_items items) { if (_tc_getPos) return _tc_getPos(items); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_getUnscaledConcentrationCC() { if (_tc_getUnscaledConcentrationCC) return _tc_getUnscaledConcentrationCC(); return tc_createMatrix(0,0); }
/*! \brief get a value from its full name \ingroup Data */ TCAPIEXPORT tc_matrix tc_getNumericalValueUsingRegexp(const char* name) { if (_tc_getNumericalValueUsingRegexp) return _tc_getNumericalValueUsingRegexp(name); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_reducedStoichiometry() { if (_tc_reducedStoichiometry) return _tc_reducedStoichiometry(); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_getUnscaledElasticities() { if (_tc_getUnscaledElasticities) return _tc_getUnscaledElasticities(); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_getScaledFluxCC() { if (_tc_getScaledFluxCC) return _tc_getScaledFluxCC(); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_getJacobian() { if (_tc_getJacobian) return _tc_getJacobian(); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_simulateStochastic(double startTime, double endTime, int numSteps) { if (_tc_simulateStochastic) return _tc_simulateStochastic(startTime, endTime, numSteps); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_simulateTauLeap(double startTime, double endTime, int numSteps) { if (_tc_simulateTauLeap) return _tc_simulateTauLeap(startTime, endTime, numSteps); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_optimize(const char * s) { if (_tc_optimize) return _tc_optimize(s); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_KMatrix() { if (_tc_KMatrix) return _tc_KMatrix(); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_elementaryFluxModes() { if (_tc_elementaryFluxModes) return _tc_elementaryFluxModes(); return tc_createMatrix(0,0); }
*/ TCAPIEXPORT tc_matrix tc_getNumericalData(long item,const char* data) { if (_tc_getNumericalData) return _tc_getNumericalData(item,data); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_getEigenvalues() { if (_tc_getEigenvalues) return _tc_getEigenvalues(); return tc_createMatrix(0,0); }
TCAPIEXPORT tc_matrix tc_steadyStateScan2D(const char * param1, double start1, double end1, int numSteps1, const char * param2, double start2, double end2, int numSteps2) { if (_tc_steadyStateScan2D) return _tc_steadyStateScan2D(param1, start1, end1, numSteps1, param1, start2, end2, numSteps2); return tc_createMatrix(0,0); }
// eigenvalues void eigen(copasi_model model, const char* param) { int i, j,k; double p; FILE * outfile; tc_matrix ss; tc_matrix output; //steady states for (i=0; i < 100; ++i) { p = (double)(i + 1)/10.0; k = cSetValue( model, param, p ); if (k) printf("calculating steady state for %s = %lf\n",param, p); ss = cGetEigenvalues(model); //ss = cGetSteadyState(model); if (i == 0) { output = tc_createMatrix(100, ss.rows+1); tc_setColumnName(output, 0, param); for (j=0; j < output.cols; ++j) tc_setColumnName(output, j+1, tc_getRowName(ss, j)); } tc_setMatrixValue(output, i, 0, p); for (j=0; j < output.cols; ++j) tc_setMatrixValue(output, i, j+1, tc_getMatrixValue(ss, j, 0)); tc_deleteMatrix(ss); } //output tc_printMatrixToFile("output.tab", output); printf("\noutput.tab contains the final output\n\n"); tc_deleteMatrix(output); }
void run(tc_matrix input) { double start = 0.0, end = 50.0; double dt = 0.1, time = 100.0; int doStochastic = 0; int selection = 0, index = 0, sz = 0, rateplot = 0, slider = 1; tc_items A, B; const char * param; FILE * out; tc_matrix params, initVals, allParams, N; char * runfuncInput = "tc_matrix input"; char * runfunc = ""; int i; if (input.cols > 0) { if (input.rows > 0) selectedItemsOnly = selection = (int)tc_getMatrixValue(input,0,0); if (input.rows > 1) doStochastic = (int)(tc_getMatrixValue(input,1,0) > 0); if (input.rows > 2) index = tc_getMatrixValue(input,2,0); if (input.rows > 3) start = tc_getMatrixValue(input,3,0); if (input.rows > 4) end = tc_getMatrixValue(input,4,0); if (input.rows > 5) dt = tc_getMatrixValue(input,5,0); if (input.rows > 6) time = tc_getMatrixValue(input,6,0); if (input.rows > 7) rateplot = tc_getMatrixValue(input,7,0); if (input.rows > 8) slider = tc_getMatrixValue(input,8,0); } if (slider == 0) slider = 1; else slider = 0; if (selection > 0) { A = tc_selectedItems(); if (tc_getItem(A,0) == 0) { tc_deleteItemsArray(A); A = tc_allItems(); } } else { A = tc_allItems(); } sz = (int)((end - start) / dt); if (tc_getItem(A,0) != 0) { tc_writeModel( "timet", A ); } else { tc_deleteItemsArray(A); return; } if (index < 0) { tc_print("steady state: no variable selected\0"); tc_deleteItemsArray(A); return; } param = tc_getString(allNames,index); //the parameter to vary strcpy(selected_var,param); if (slider) { params = tc_getParameters(A); N = tc_getStoichiometry(A); B = tc_findItems(N.rownames); tc_deleteMatrix(N); initVals = tc_getInitialValues(B); allParams = tc_createMatrix(initVals.rows+params.rows,2); for (i=0; i < params.rows; ++i) { tc_setRowName(allParams,i, tc_getRowName(params,i)); tc_setMatrixValue(allParams,i,0,tc_getMatrixValue(params,i,0)/10.0); tc_setMatrixValue(allParams,i,1, 2*tc_getMatrixValue(params,i,0) - tc_getMatrixValue(allParams,i,0)); } for (i=0; i < initVals.rows; ++i) { tc_setRowName(allParams,i+params.rows, tc_getRowName(initVals,i)); tc_setMatrixValue(allParams,i+params.rows,0,tc_getMatrixValue(initVals,i,0)/10.0); tc_setMatrixValue(allParams,i+params.rows,1, 2*tc_getMatrixValue(initVals,i,0) - tc_getMatrixValue(allParams,i+params.rows,0)); } tc_deleteMatrix(initVals); tc_deleteMatrix(params); tc_deleteItemsArray(B); runfunc = runfuncInput; } tc_deleteItemsArray(A); out = fopen("timet.c","a"); fprintf( out , "\ #include \"TC_api.h\"\n#include \"cvodesim.h\"\n#include \"ssa.h\"\n\ TCAPIEXPORT void run(%s) \n\ {\n initMTrand();\n tc_matrix dat;\n int i,j;\n", runfunc ); fprintf( out, "\ dat.rows = (int)((%lf-%lf)/%lf);\n\ double * y, * y0, *y1;\n\ TCmodel * model = (TCmodel*)malloc(sizeof(TCmodel));\n\ (*model) = TC_initial_model;\n\ if (%i) \n\ {\n\ dat.cols = 1+TCreactions;\n\ dat.colnames = tc_createStringsArray(TCreactions);\n\ for(i=0; i<TCreactions; ++i) dat.colnames.strings[1+i] = TCreactionnames[i];\n\ }\n\ else\n\ {\n\