Пример #1
0
  public void setup() {
    clear();
    Protein protein = gene.getProtein();
    if (aminoAcid != null) addSubstance(aminoAcid, -1.0);
    addSubstance(gene.getRibosome(), 0.0);
    addSubstance(protein, 3.0 / (gene.getLength()));
    rateExpression =
        DMath.multiply(
            gene.getRibosome().getElongationRate(),
            DMath.min(
                DMath.multiply(
                    gene.getRibosome(),
                    DMath.divide(
                        DMath.multiply(gene.getKTranslation(), gene.getRna()),
                        gene.getRibosome().getTotalTranslationActivity())),
                //
                // the maximum # of ribosomes that can be allocated to a
                // gene
                // is the gene length divided by the ribosome spacing
                // requirement.
                //
                DMath.divide(
                    DMath.multiply(new Constant(gene.getLength() / 3.0), gene.getRna()),
                    gene.getRibosome().getSpacing())));
    //
    // hack: used to make sure that when aminoAcid is set, the rate should
    // be zero
    // when amino acids are all consumed.
    //
    // better implementation is by using the MichaelisMenten reaction
    // scheme, but
    // it needs an additional parameter.
    //

    if (aminoAcid != null)
      rateExpression =
          DMath.multiply(
              rateExpression, DMath.divide(aminoAcid, DMath.sum(aminoAcid, new Constant(1e4))));
  }
Пример #2
0
 public DMatrix vectorNorm() {
   DMatrix m = DMath.createMatrix(this.rows(), this.columns(), this.toArray());
   DMatrix Denom = this.mul(this).sumColumns();
   Denom.sqrti();
   return m.divRows(Denom);
 }
Пример #3
0
 public DMatrix sumColumns() {
   DMatrix sum = DMath.createMatrix(this.rows, 1);
   DMatrix multiplier = DMath.createOnesMatrix(this.columns, 1);
   SimpleCuBlas.gemm(false, false, this, multiplier, sum, 1.0, 0.0);
   return sum;
 }
Пример #4
0
 public DMatrix sumRows(int startRow, int howMany) {
   DMatrix sum = DMath.createMatrix(1, this.columns());
   DMatrix multiplier = DMath.createOnesMatrix(1, howMany);
   SimpleCuBlas.cust_gemv(false, this, multiplier, sum, 1.0, 0.0, startRow, howMany);
   return sum;
 }
Пример #5
0
 public DMatrix sumRows() {
   DMatrix sum = DMath.createZerosMatrix(1, this.columns());
   DMatrix multiplier = DMath.createOnesMatrix(1, this.rows);
   SimpleCuBlas.gemv(false, this, multiplier, sum, 1.0, 0.0);
   return sum;
 }
Пример #6
0
 public DMatrix sub(double v) {
   DMatrix m = DMath.createMatrix(this.rows(), this.columns(), this.toArray());
   for (int i = 0; i < this.length(); i++) m.put(i, m.get(i) - v);
   return m;
 }
Пример #7
0
 public DMatrix inv() {
   DMatrix m = DMath.createMatrix(this.rows(), this.columns(), this.toArray());
   SimpleCuBlas.inverseElements(m);
   return m;
 }