Skip to content

Commit

Permalink
Release 0.11.21
Browse files Browse the repository at this point in the history
Merge pull request #1596 from AMICI-dev/release/0.11.21
  • Loading branch information
dweindl authored Nov 22, 2021
2 parents e79215d + 9fe5e04 commit 82d2cbb
Show file tree
Hide file tree
Showing 16 changed files with 505 additions and 320 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ python/examples/example_presimulation/model_presimulation_re/*
python/examples/example_constant_species/model_constant_species_reduced/*
python/examples/example_constant_species/model_constant_species/*
python/tests/sbml_test_models/*
python/tests/piecewise_test/*

python/sdist/amici.egg-info/*
python/sdist/amici/version.txt
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

## v0.X Series

### v0.11.21 (2021-11-21)

Fixes:
* Fixed a bug in recursion depth computation for model expressions. This may
have resulted in incorrect sensitivities for models with expressions nested
more than 2 levels. (#1595)
* Fixed improper handling of Piecewise functions in PySB import which may have
produced incorrect simulation results. (#1594)
* Fixed changed googletest reference which broke the CMake-based build if
tests were enabled (#1592)

New:
* It's now possible to build AMICI using Ninja (#1593)


### v0.11.20 (2021-11-12)

New:
Expand Down
11 changes: 11 additions & 0 deletions include/amici/sundials_matrix_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,17 @@ class SUNMatrixWrapper {
*/
void multiply(N_Vector c, const_N_Vector b, realtype alpha = 1.0) const;

/**
* @brief AmiVector interface for multiply
* @param c output vector, may already contain values
* @param b multiplication vector
* @param alpha scalar coefficient for matrix
*/
void multiply(AmiVector& c, AmiVector const& b, realtype alpha = 1.0) const {
multiply(c.getNVector(), b.getNVector(), alpha);
}


/**
* @brief Perform matrix vector multiplication c += alpha * A*b
* @param c output vector, may already contain values
Expand Down
71 changes: 71 additions & 0 deletions include/amici/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,44 @@ class AmiVector {
*/
AmiVector &operator=(AmiVector const &other);

/**
* @brief operator *= (element-wise multiplication)
* @param multiplier multiplier
* @return result
*/
AmiVector &operator*=(AmiVector const& multiplier) {
N_VProd(getNVector(),
const_cast<N_Vector>(multiplier.getNVector()),
getNVector());
return *this;
}

/**
* @brief operator /= (element-wise division)
* @param divisor divisor
* @return result
*/
AmiVector &operator/=(AmiVector const& divisor) {
N_VDiv(getNVector(),
const_cast<N_Vector>(divisor.getNVector()),
getNVector());
return *this;
}

/**
* @brief Returns an iterator that points to the first element of the
* vector.
* @return iterator that points to the first element
*/
auto begin() { return vec_.begin(); }

/**
* @brief Returns an iterator that points to one element after the last
* element of the vector.
* @return iterator that points to one element after the last element
*/
auto end() { return vec_.end(); }

/**
* @brief data accessor
* @return pointer to data array
Expand Down Expand Up @@ -164,6 +202,13 @@ class AmiVector {
*/
void copy(const AmiVector &other);

/**
* @brief Take absolute value (in-place)
*/
void abs() {
N_VAbs(getNVector(), getNVector());
};

private:
/** main data storage */
std::vector<realtype> vec_;
Expand Down Expand Up @@ -315,6 +360,32 @@ class AmiVectorArray {
std::vector<N_Vector> nvec_array_;
};

/**
* @brief Computes z = a*x + b*y
* @param a coefficient for x
* @param x a vector
* @param b coefficient for y
* @param y another vector with same size as x
* @param z result vector of same size as x and y
*/
inline void linearSum(realtype a, AmiVector const& x, realtype b,
AmiVector const& y, AmiVector& z) {
N_VLinearSum(a, const_cast<N_Vector>(x.getNVector()),
b, const_cast<N_Vector>(y.getNVector()),
z.getNVector());
}

/**
* @brief Compute dot product of x and y
* @param x vector
* @param y vector
* @return dot product of x and y
*/
inline realtype dotProd(AmiVector const& x, AmiVector const& y) {
return N_VDotProd(const_cast<N_Vector>(x.getNVector()),
const_cast<N_Vector>(y.getNVector()));
}

} // namespace amici


Expand Down
Loading

0 comments on commit 82d2cbb

Please sign in to comment.