COPASI API  4.16.103
CLNAMethod.cpp
Go to the documentation of this file.
1 // Copyright (C) 2011 - 2015 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 #include <cmath>
7 #include <limits>
8 
9 #include "copasi.h"
10 #include "model/CModel.h"
11 #include "utilities/utility.h"
12 #include "utilities/CCopasiTask.h"
13 #include "utilities/CReadConfig.h"
14 #include "CLNAMethod.h"
15 #include "CLNAProblem.h"
16 
17 #include "lapack/blaswrap.h"
18 #include "lapack/lapackwrap.h"
19 
20 // static
22 {
23  return new CLNAMethod();
24 }
25 
26 /**
27  * Default constructor
28  */
30  CCopasiMethod(CCopasiTask::lna, CCopasiMethod::linearNoiseApproximation, pParent),
31  mpModel(NULL),
32  mSteadyStateResolution(1.0e-9),
33  mSSStatus(CSteadyStateMethod::notFound)
34 {
36  initObjects();
37 }
38 
40  const CCopasiContainer * pParent):
41  CCopasiMethod(src, pParent),
42  mpModel(NULL),
43  mSteadyStateResolution(src.mSteadyStateResolution),
44  mSSStatus(CSteadyStateMethod::notFound)
45 {
47  initObjects();
48 }
49 
51 {
52  CArrayAnnotation * tmp;
53 
54  tmp = new CArrayAnnotation("B matrix (reduced)", this,
57  tmp->setDescription("B matrix (reduced)");
58  tmp->setDimensionDescription(0, "Species (reduced system)");
59  tmp->setDimensionDescription(1, "Species (reduced system)");
60  mBMatrixReducedAnn = tmp;
61 
62  tmp = new CArrayAnnotation("Covariance matrix (reduced)", this,
65  tmp->setDescription("Covariance matrix (reduced)");
66  tmp->setDimensionDescription(0, "Species (reduced system)");
67  tmp->setDimensionDescription(1, "Species (reduced system)");
69 
70  tmp = new CArrayAnnotation("Covariance matrix", this,
73  tmp->setDescription("Covariance matrix");
74  tmp->setDimensionDescription(0, "Species (full system)");
75  tmp->setDimensionDescription(1, "Species (full system)");
77 }
78 
79 /**
80  * Deconstructor
81  */
83 {
85 }
86 
88 {
89  /* CCopasiParameter *pParm;
90 
91  assertParameter("Placeholder Factor", CCopasiParameter::UDOUBLE, 1.0e-009);
92 
93  if ((pParm = getParameter("LNA.PlaceholderFactor")) != NULL)
94  {
95  setValue("Placeholder Factor", *pParm->getValue().pUDOUBLE);
96  removeParameter("LNA.PlaceholderFactor");
97  }
98  */
99 }
100 
102 {
104  return true;
105 }
106 
108 {
109  if (!mpModel) return;
110 
115 
120 
125 }
126 
128 {
129  // code snippet: transform something into particle space:
130  // *(metabs[i]->getCompartment())->getValue()*mpModel->getQuantity2NumberFactor();
131 
132  assert(mpModel);
133 
136  const CVector< C_FLOAT64 > & ParticleFlux = mpModel->getParticleFlux();
137 
138  size_t numReacs = reacs.size();
139 
140  // We need the number of independent metabolites determined by
141  // reactions.
142  size_t numMetabs = mpModel->getNumIndependentReactionMetabs();
143 
144  size_t i, j, k;
145  const CMetab * pMetabolite;
146  C_FLOAT64 balance_i, balance_j, BContrib;
147 
148  // calculate covariances
149  // first, set BMatrix (reduced) to zero
150  mBMatrixReduced.resize(numMetabs, numMetabs);
151  mBMatrixReduced = 0.0;
152 
153  // second, set CovarianceMatrixReduced to zero
154  mCovarianceMatrixReduced.resize(numMetabs, numMetabs);
156 
157  // then, calculate the contribution for each reaction
158  // and add these contributions to the respective mBMatrix elements
159  // only consider independent metabolites determined by reactions,
160  // e.g. those that contribute to the reduced stoichiometry matrix.
161  // Note: This could also be computed using mRedStoi in CModel.
162  // However, then it would probably be less efficient for very
163  // big systems since mRedStoi should be sparse there.
164  for (k = 0; k < numReacs; k++)
165  {
166  const CCopasiVector <CChemEqElement> & Balances =
167  reacs[k]->getChemEq().getBalances();
168 
172 
173  for (itRow = Balances.begin(); itRow != itEnd; ++itRow)
174  {
175  pMetabolite = (*itRow)->getMetabolite();
176  i = metabs.getIndex(pMetabolite);
177 
178  if (i < numMetabs)
179  {
180  balance_i = (*itRow)->getMultiplicity();
181 
182  // This check is no longer needed since we check the index for validity, i.e. we are assured to have an independent metabolite
183  if ((pMetabolite->getStatus() != CModelEntity::REACTIONS) || (pMetabolite->isDependent())) balance_i = 0.0;
184 
185  for (itColumn = Balances.begin(); itColumn != itEnd; ++itColumn)
186  {
187  pMetabolite = (*itColumn)->getMetabolite();
188  j = metabs.getIndex(pMetabolite);
189 
190  if (j < numMetabs)
191  {
192  balance_j = (*itColumn)->getMultiplicity();
193 
194  // This check is no longer needed since we check the index for validity, i.e. we are assured to have an independent metabolite
195  if ((pMetabolite->getStatus() != CModelEntity::REACTIONS) || (pMetabolite->isDependent())) balance_j = 0.0;
196 
197  BContrib = ParticleFlux[k] * balance_i * balance_j;
198  mBMatrixReduced[i][j] += BContrib;
199  }
200  }
201  }
202  }
203  }
204 
205  // finally, solve the Lyapunov equation A*C + C*A^T + B = 0 for C
206  // using the Bartels & Stewart algorithm (1972)
207 
208  // 1. (Schur) transform the Jacobian matrix A (reduced) and its transpose At
209 
210  // get the Jacobian (reduced)
211  C_FLOAT64 derivationFactor = 1e-6;
212  C_FLOAT64 resolution = 1e-12;
213  mpModel->calculateJacobianX(mJacobianReduced, derivationFactor, resolution);
214 
215  // copy the Jacobian (reduced) into A
218  C_FLOAT64 * pA = A.array();
219  C_FLOAT64 * pAEnd = pA + A.size();
220  const C_FLOAT64 * pMatrix = mJacobianReduced.array();
221 
222  for (; pA != pAEnd; ++pA, ++pMatrix)
223  {
224  *pA = *pMatrix;
225 
226  if (!finite(*pA) && !isnan(*pA))
227  {
228  if (*pA > 0)
230  else
232  }
233  }
234 
235  char jobvs = 'V'; // Schur vectors are computed
236  char sort = 'N'; // Eigenvalues are not ordered
237  C_INT n = (C_INT)A.numRows();
238  C_INT lda = n > 1 ? n : 1;
239  C_INT sdim; // output
241  wr_A.resize((size_t)n);
243  wi_A.resize((size_t)n);
244  CMatrix< C_FLOAT64> vs_A; // output (unitary matrix)
245  C_INT ldvs_A = n;
246  vs_A.resize((size_t)ldvs_A, (size_t)ldvs_A);
247  CVector< C_FLOAT64 > work = 1;
248  C_INT lwork;
249  C_LOGICAL * pbwork = NULL;
250  C_INT info;
251 
252  // LWORK workspace query
253  lwork = -1;
254  dgees_(&jobvs,
255  &sort,
256  NULL,
257  &n,
258  A.array(),
259  &lda,
260  &sdim,
261  wr_A.array(),
262  wi_A.array(),
263  vs_A.array(),
264  &ldvs_A,
265  work.array(),
266  &lwork,
267  pbwork,
268  &info);
269 
270  if (info != 0)
271  {
272  // TODO(juergen): add appropriate exception message(s)!
273  // CCopasiMessage(CCopasiMessage::EXCEPTION, MCLNA + 1, -mInfo);
274  }
275 
276  lwork = (C_INT) work[0];
277  work.resize((size_t)lwork);
278 
279  dgees_(&jobvs,
280  &sort,
281  NULL,
282  &n,
283  A.array(), // input: matrix / output: real Schur form
284  &lda,
285  &sdim,
286  wr_A.array(),
287  wi_A.array(),
288  vs_A.array(),
289  &ldvs_A,
290  work.array(),
291  &lwork,
292  pbwork,
293  &info);
294 
295  if (info != 0)
296  {
297  // TODO(juergen): add appropriate exception message(s)!
298  // CCopasiMessage(CCopasiMessage::EXCEPTION, MCLNA + 1, -mInfo);
299  }
300 
301  // now, (Schur) transform the transposed Jacobian (reduced)
302 
303  // copy the transposed Jacobian (reduced) into At
306 
307  for (i = 0; i < mJacobianReduced.numRows(); i++)
308  {
309  for (j = 0; j < mJacobianReduced.numCols(); j++)
310  {
311  At[j][i] = mJacobianReduced[i][j];
312 
313  if (!finite(At[j][i]) && !isnan(At[j][i]))
314  {
315  if (At[j][i] > 0)
317  else
319  }
320  }
321  }
322 
323  jobvs = 'V'; // Schur vectors are computed
324  sort = 'N'; // Eigenvalues are not ordered
325  n = (C_INT)At.numRows();
326  lda = n > 1 ? n : 1;
327  // C_INT sdim; // output
328  CVector< C_FLOAT64 > wr_At;
329  wr_At.resize((size_t)n);
330  CVector< C_FLOAT64 > wi_At;
331  wi_At.resize((size_t)n);
332  CMatrix< C_FLOAT64 > vs_At; // output (unitary matrix)
333  C_INT ldvs_At = n;
334  vs_At.resize((size_t)ldvs_At, (size_t)ldvs_At);
335  work = 1;
336  // C_INT lwork;
337  pbwork = NULL;
338  // C_INT info;
339 
340  // LWORK workspace query
341  lwork = -1;
342  dgees_(&jobvs,
343  &sort,
344  NULL,
345  &n,
346  At.array(),
347  &lda,
348  &sdim,
349  wr_At.array(),
350  wi_At.array(),
351  vs_At.array(),
352  &ldvs_At,
353  work.array(),
354  &lwork,
355  pbwork,
356  &info);
357 
358  if (info != 0)
359  {
360  // TODO(juergen): add appropriate exception message(s)!
361  // CCopasiMessage(CCopasiMessage::EXCEPTION, MCLNA + 1, -mInfo);
362  }
363 
364  lwork = (C_INT) work[0];
365  work.resize((size_t)lwork);
366 
367  dgees_(&jobvs,
368  &sort,
369  NULL,
370  &n,
371  At.array(), // input: matrix / output: real Schur form
372  &lda,
373  &sdim,
374  wr_At.array(),
375  wi_At.array(),
376  vs_At.array(),
377  &ldvs_At,
378  work.array(),
379  &lwork,
380  pbwork,
381  &info);
382 
383  if (info != 0)
384  {
385  // TODO(juergen): add appropriate exception message(s)!
386  // CCopasiMessage(CCopasiMessage::EXCEPTION, MCLNA + 1, -mInfo);
387  }
388 
389  // 2. transform the mBMatrixReduced B to new coordinates
390  // BMatrixReduced_transformed = (unitary At)^T * mBMatrixReduced * (unitary A);
391 
392  char transa = 'T'; // (unitary A) will be transposed
393  char transb = 'N'; // mBMatrixReduced will not be transposed
394  C_FLOAT64 alpha = 1.0;
395  C_FLOAT64 beta = 0.0;
397  C_INT ldd = n;
398  D.resize((size_t)n, (size_t)n);
399 
400  dgemm_(&transa,
401  &transb,
402  &n,
403  &n,
404  &n,
405  &alpha,
406  vs_At.array(),
407  &n,
409  &n,
410  &beta,
411  D.array(), // output: multiplied matrix
412  &ldd);
413 
414  transa = 'N';
415  CMatrix< C_FLOAT64 > BMatrixReduced_transformed;
416  C_INT BMatrixReduced_transformed_d = n;
417  BMatrixReduced_transformed.resize((size_t)n, (size_t)n);
418 
419  dgemm_(&transa,
420  &transb,
421  &n,
422  &n,
423  &n,
424  &alpha,
425  D.array(),
426  &n,
427  vs_A.array(), // (unitary At)
428  &n,
429  &beta,
430  BMatrixReduced_transformed.array(),
431  &BMatrixReduced_transformed_d);
432 
433  // 3. Solve the simplified Lyapunov (Sylvester) Equation
434 
435  char trana = 'N'; // no transpose of A
436  char tranb = 'N'; // no transpose of B
437  C_INT isgn = 1; // sign in the equation is "+"
438  C_FLOAT64 scale; // output
439 
440  // DTRSYL solves the real Sylvester matrix equation:
441  //
442  // op(A)*X + X*op(B) = scale*C or
443  // op(A)*X - X*op(B) = scale*C,
444  //
445  // where op(A) = A or A**T, and A and B are both upper quasi-
446  // triangular. A is M-by-M and B is N-by-N; the right hand side C and
447  // the solution X are M-by-N; and scale is an output scale factor, set
448  // <= 1 to avoid overflow in X.
449  dtrsyl_(&trana,
450  &tranb,
451  &isgn,
452  &n,
453  &n,
454  At.array(), // Schur transform of the Jacobian (reduced)
455  &n,
456  A.array(), // Schur transform of the transposed Jacobian (reduced)
457  &n,
458  BMatrixReduced_transformed.array(), // output / input (the coordinate-transformed mBMatrix (reduced))
459  &n,
460  &scale,
461  &info);
462 
463  if (info != 0)
464  {
465  // TODO(juergen): add appropriate exception message(s)!
466  // CCopasiMessage(CCopasiMessage::EXCEPTION, MCLNA + 1, -mInfo);
467  }
468 
469  // 4. Calculate the original matrix C: -(unitary At)*BMatrixReduced_transformed*(unitary A)^T;
470 
471  transa = 'N';
472  transb = 'N';
473  alpha = -1.0;
474  beta = 0.0;
475  ldd = n;
476  D.resize((size_t)n, (size_t)n);
477 
478  dgemm_(&transa,
479  &transb,
480  &n,
481  &n,
482  &n,
483  &alpha,
484  vs_At.array(),
485  &n,
486  BMatrixReduced_transformed.array(), // BMatrixReduced_transformed.array() holds the output of dtrsyl() now
487  &n,
488  &beta,
489  D.array(),
490  &ldd);
491 
492  transa = 'N';
493  transb = 'T';
494  alpha = 1.0;
495  beta = 0.0;
496  mCovarianceMatrixReduced.resize((size_t)n, (size_t)n);
497 
498  dgemm_(&transa,
499  &transb,
500  &n,
501  &n,
502  &n,
503  &alpha,
504  D.array(),
505  &n,
506  vs_A.array(),
507  &n,
508  &beta,
510  &n);
511 
512  return LNA_OK;
513 }
514 
515 /**
516  * Re-calculate covariances for the full system
517  */
519 {
520  // the covariance matrix of the full system is calculated from
521  // the covariance matrix of the reduced system by:
522  // mL*mCovarianceMatrixReduced*mL^T, with mL the link matrix
523 
524  C_INT i, j;
525 
526  C_INT numIndependentMetabs = (C_INT)mpModel->getNumIndependentReactionMetabs();
528  C_INT numDependentMetabs = numReactionMetabs - numIndependentMetabs;
529 
530  CMatrix<C_FLOAT64> mL0;
531  mL0 = mpModel->getL0();
532  mL.resize((size_t)numReactionMetabs, (size_t)numIndependentMetabs);
533  mL = 0.0;
534 
535  for (i = 0; i < numIndependentMetabs; i++) mL[(size_t)i][(size_t)i] = 1.0;
536 
537  for (i = 0; i < numDependentMetabs; i++)
538  for (j = 0; j < numIndependentMetabs; j++)
539  mL[(size_t)i + (size_t)numIndependentMetabs][(size_t)j] = mL0[(size_t)i][(size_t)j];
540 
542  D.resize((size_t)numIndependentMetabs, (size_t)numReactionMetabs);
543  D = 0.0;
544 
545  // take care of different memory layouts in C and FORTRAN (e.g. BLAS routines)
546  char transa = 'T';
547  char transb = 'T';
548  C_FLOAT64 alpha = 1.0;
549  C_FLOAT64 beta = 0.0;
550 
551  dgemm_(&transa,
552  &transb,
553  &numReactionMetabs,
554  &numIndependentMetabs,
555  &numIndependentMetabs,
556  &alpha,
557  mL.array(),
558  &numIndependentMetabs,
560  &numIndependentMetabs,
561  &beta,
562  D.array(),
563  &numReactionMetabs);
564 
565  // take care of different memory layouts in C and FORTRAN (e.g. BLAS routines)
566  transa = 'N';
567  transb = 'N';
568  alpha = 1.0;
569  beta = 0.0;
570  mCovarianceMatrix.resize((size_t)numReactionMetabs, (size_t)numReactionMetabs);
571  mCovarianceMatrix = 0.0;
572 
573  dgemm_(&transa,
574  &transb,
575  &numReactionMetabs,
576  &numReactionMetabs,
577  &numIndependentMetabs,
578  &alpha,
579  D.array(),
580  &numReactionMetabs,
581  mL.array(),
582  &numIndependentMetabs,
583  &beta,
585  &numReactionMetabs);
586 }
587 
588 /**
589  * Set the Model
590  */
592 {
593  mpModel = model;
594 }
595 
596 /**
597  * the LNA entry point
598  * @param status refers to the steady-state solution
599  * @param res refers to the resolution
600  */
602 {
603  assert(mpModel);
604 
606  {
608  {
610  return LNA_OK;
611  }
612  }
613 
614  // something went wrong
615  mBMatrixReduced = std::numeric_limits< C_FLOAT64 >::quiet_NaN();
616  mCovarianceMatrixReduced = std::numeric_limits< C_FLOAT64 >::quiet_NaN();
617  mCovarianceMatrix = std::numeric_limits< C_FLOAT64 >::quiet_NaN();
618  return LNA_NOT_OK;
619 }
620 
621 /**
622  * Read some parameters from configuration file.
623  */
625 {
626  C_INT32 Fail = 0;
627  /*
628  if ((Fail = configBuffer.getVariable("SSMCAUnscaled", "C_INT16",
629  (void *) & mSSReder,
630  CReadConfig::LOOP)))
631  return Fail;
632  */
633  return Fail;
634 }
635 
637 {
638  return (CalculateLNA() == LNA_OK);
639  // maybe, introduce additional checks here later
640 }
641 
643 {
644  mSSStatus = SSStatus;
645 }
646 
648 {
649  mEVStatus = status;
650 }
651 
653 {
654  this->mSteadyStateResolution = resolution;
655 }
656 
658 {
659  return this->mpModel;
660 }
661 
662 //virtual
664 {
665  if (!CCopasiMethod::isValidProblem(pProblem)) return false;
666 
667  const CLNAProblem * pP = dynamic_cast<const CLNAProblem *>(pProblem);
668 
669  if (!pP)
670  {
671  //not a CLNAProblem
672  CCopasiMessage(CCopasiMessage::ERROR, "Problem is not a LNA problem.");
673  return false;
674  }
675 
676  CModel * pModel = pP->getModel();
677 
678  if (pModel == NULL)
679  return false;
680 
681  // Check if the model contains species that have assignments or
682  // explicit ODEs.
683  if (pModel->getNumAssignmentMetabs() > 0)
684  {
685  CCopasiMessage(CCopasiMessage::ERROR, "LNA is not applicable for a system with species assignments.");
686  return false;
687  }
688 
689  if (pModel->getNumODEMetabs() > 0)
690  {
691  CCopasiMessage(CCopasiMessage::ERROR, "LNA is not applicable for a system with explicit ODEs for species.");
692  return false;
693  }
694 
695  //if (pModel->getCompartments().size() > 1)
696  // {
697  // CCopasiMessage(CCopasiMessage::ERROR, "LNA is not applicable for a system with more than one compartment.");
698  // return false;
699  //}
700 
701  // Check if the model has a compartment with an assignment or ODE
704 
705  for (; it != end; ++it)
706  if ((*it)->getStatus() != CModelEntity::FIXED)
707  {
708  CCopasiMessage(CCopasiMessage::ERROR, "LNA is not applicable for a system with changing volumes, e.g. compartment assignments or ODEs.");
709  return false;
710  }
711 
712  CCopasiVector< CReaction > & reacs = pModel->getReactions();
713  size_t numReacs = reacs.size();
714  size_t i;
715 
716  for (i = 0; i < numReacs; i++) // for every reaction
717  {
718  // TEST isReversible() == 0
719  if (reacs[i]->isReversible() != 0)
720  {
721  CCopasiMessage(CCopasiMessage::ERROR, "At least one reaction is reversible. That means it is not possible to calculate the LNA. \nYou can use \"Tools|Convert to irreversible\" which will split the reversible reactions \n into two irreversible reactions. However you should check the kinetics afterwards.");
722  return false;
723  }
724  }
725 
726  return true;
727 }
CMatrix< C_FLOAT64 > mL
Definition: CLNAMethod.h:57
CArrayAnnotation * mCovarianceMatrixReducedAnn
Definition: CLNAMethod.h:48
#define C_INT
Definition: copasi.h:115
void calculateCovarianceMatrixFull()
Definition: CLNAMethod.cpp:518
CMatrix< C_FLOAT64 > mCovarianceMatrix
Definition: CLNAMethod.h:50
C_FLOAT64 mSteadyStateResolution
Definition: CLNAMethod.h:59
CLNAMethod(const CCopasiContainer *pParent=NULL)
Definition: CLNAMethod.cpp:29
int dtrsyl_(char *trana, char *tranb, integer *isgn, integer *m, integer *n, doublereal *a, integer *lda, doublereal *b, integer *ldb, doublereal *c__, integer *ldc, doublereal *scale, integer *info)
virtual bool elevateChildren()
Definition: CLNAMethod.cpp:101
virtual size_t size() const
C_INT32 load(CReadConfig &configBuffer)
Definition: CLNAMethod.cpp:624
virtual bool process()
Definition: CLNAMethod.cpp:636
const CVector< C_FLOAT64 > & getParticleFlux() const
Definition: CModel.cpp:1045
iterator begin()
virtual size_t numRows() const
Definition: CMatrix.h:138
virtual void resizeAllMatrices()
Definition: CLNAMethod.cpp:107
void calculateJacobianX(CMatrix< C_FLOAT64 > &jacobianX, const C_FLOAT64 &derivationFactor, const C_FLOAT64 &resolution)
Definition: CModel.cpp:2082
CLNAMethod::EVStatus mEVStatus
Definition: CLNAMethod.h:63
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
static CLNAMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::linearNoiseApproximation)
Definition: CLNAMethod.cpp:21
void setDescription(const std::string &s)
size_t getNumODEMetabs() const
Definition: CModel.cpp:1124
#define C_UNUSED(p)
Definition: copasi.h:220
#define C_INT32
Definition: copasi.h:90
virtual ~CLNAMethod()
Definition: CLNAMethod.cpp:82
Definition: CMetab.h:178
void setEigenValueStatus(CLNAMethod::EVStatus status)
Definition: CLNAMethod.cpp:647
virtual bool isValidProblem(const CCopasiProblem *pProblem)
#define C_LOGICAL
Definition: copasi.h:122
const CModel * getModel() const
Definition: CLNAMethod.cpp:657
#define DESTRUCTOR_TRACE
Definition: copasi.h:206
#define LNA_NOT_OK
Definition: CLNAMethod.h:24
iterator end()
std::vector< CType * >::const_iterator const_iterator
Definition: CCopasiVector.h:57
int CalculateLNA()
Definition: CLNAMethod.cpp:601
size_t getNumDependentReactionMetabs() const
Definition: CModel.cpp:1133
CMatrix< C_FLOAT64 > mCovarianceMatrixReduced
Definition: CLNAMethod.h:47
void setCopasiVector(size_t d, const CCopasiContainer *v)
int dgemm_(char *transa, char *transb, integer *m, integer *n, integer *k, doublereal *alpha, doublereal *a, integer *lda, doublereal *b, integer *ldb, doublereal *beta, doublereal *c, integer *ldc)
CMatrix< C_FLOAT64 > mBMatrixReduced
Definition: CLNAMethod.h:44
virtual bool isValidProblem(const CCopasiProblem *pProblem)
Definition: CLNAMethod.cpp:663
virtual void resize(size_t rows, size_t cols, const bool &copy=false)
Definition: CMatrix.h:151
size_t getNumIndependentReactionMetabs() const
Definition: CModel.cpp:1130
bool isDependent() const
Definition: CMetab.cpp:989
CMatrix< C_FLOAT64 > mJacobianReduced
Definition: CLNAMethod.h:54
void setMode(size_t d, Mode m)
CModel * mpModel
Definition: CLNAMethod.h:39
CCopasiVectorNS< CCompartment > & getCompartments()
Definition: CModel.cpp:1145
void setDimensionDescription(size_t d, const std::string &s)
virtual size_t getIndex(const CCopasiObject *pObject) const
void setModel(CModel *model)
Definition: CLNAMethod.cpp:591
#define C_FLOAT64
Definition: copasi.h:92
size_t getNumAssignmentMetabs() const
Definition: CModel.cpp:1127
void initializeParameter()
Definition: CLNAMethod.cpp:87
CType * array()
Definition: CVector.h:139
void initObjects()
Definition: CLNAMethod.cpp:50
int calculateCovarianceMatrixReduced()
Definition: CLNAMethod.cpp:127
void setSteadyStateStatus(CSteadyStateMethod::ReturnCode SSStatus)
Definition: CLNAMethod.cpp:642
virtual size_t size() const
Definition: CMatrix.h:132
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
CSteadyStateMethod::ReturnCode mSSStatus
Definition: CLNAMethod.h:61
int dgees_(char *jobvs, char *sort, L_fp select, integer *n, doublereal *a, integer *lda, integer *sdim, doublereal *wr, doublereal *wi, doublereal *vs, integer *ldvs, doublereal *work, integer *lwork, logical *bwork, integer *info)
void setSteadyStateResolution(C_FLOAT64 factor)
Definition: CLNAMethod.cpp:652
const CLinkMatrix & getL0() const
Definition: CModel.cpp:1169
Definition: CModel.h:50
const CModelEntity::Status & getStatus() const
const CCopasiVector< CMetab > & getMetabolitesX() const
Definition: CModel.cpp:1057
virtual size_t numCols() const
Definition: CMatrix.h:144
CArrayAnnotation * mCovarianceMatrixAnn
Definition: CLNAMethod.h:51
#define LNA_OK
Definition: CLNAMethod.h:23
CArrayAnnotation * mBMatrixReducedAnn
Definition: CLNAMethod.h:45
virtual CType * array()
Definition: CMatrix.h:337
CModel * getModel() const
#define max(a, b)
Definition: f2c.h:176