Skip to content

Commit 82d2cbb

Browse files
authored
Release 0.11.21
Merge pull request #1596 from AMICI-dev/release/0.11.21
2 parents e79215d + 9fe5e04 commit 82d2cbb

16 files changed

+505
-320
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ python/examples/example_presimulation/model_presimulation_re/*
154154
python/examples/example_constant_species/model_constant_species_reduced/*
155155
python/examples/example_constant_species/model_constant_species/*
156156
python/tests/sbml_test_models/*
157+
python/tests/piecewise_test/*
157158

158159
python/sdist/amici.egg-info/*
159160
python/sdist/amici/version.txt

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
## v0.X Series
44

5+
### v0.11.21 (2021-11-21)
6+
7+
Fixes:
8+
* Fixed a bug in recursion depth computation for model expressions. This may
9+
have resulted in incorrect sensitivities for models with expressions nested
10+
more than 2 levels. (#1595)
11+
* Fixed improper handling of Piecewise functions in PySB import which may have
12+
produced incorrect simulation results. (#1594)
13+
* Fixed changed googletest reference which broke the CMake-based build if
14+
tests were enabled (#1592)
15+
16+
New:
17+
* It's now possible to build AMICI using Ninja (#1593)
18+
19+
520
### v0.11.20 (2021-11-12)
621

722
New:

include/amici/sundials_matrix_wrapper.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,17 @@ class SUNMatrixWrapper {
325325
*/
326326
void multiply(N_Vector c, const_N_Vector b, realtype alpha = 1.0) const;
327327

328+
/**
329+
* @brief AmiVector interface for multiply
330+
* @param c output vector, may already contain values
331+
* @param b multiplication vector
332+
* @param alpha scalar coefficient for matrix
333+
*/
334+
void multiply(AmiVector& c, AmiVector const& b, realtype alpha = 1.0) const {
335+
multiply(c.getNVector(), b.getNVector(), alpha);
336+
}
337+
338+
328339
/**
329340
* @brief Perform matrix vector multiplication c += alpha * A*b
330341
* @param c output vector, may already contain values

include/amici/vector.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,44 @@ class AmiVector {
8686
*/
8787
AmiVector &operator=(AmiVector const &other);
8888

89+
/**
90+
* @brief operator *= (element-wise multiplication)
91+
* @param multiplier multiplier
92+
* @return result
93+
*/
94+
AmiVector &operator*=(AmiVector const& multiplier) {
95+
N_VProd(getNVector(),
96+
const_cast<N_Vector>(multiplier.getNVector()),
97+
getNVector());
98+
return *this;
99+
}
100+
101+
/**
102+
* @brief operator /= (element-wise division)
103+
* @param divisor divisor
104+
* @return result
105+
*/
106+
AmiVector &operator/=(AmiVector const& divisor) {
107+
N_VDiv(getNVector(),
108+
const_cast<N_Vector>(divisor.getNVector()),
109+
getNVector());
110+
return *this;
111+
}
112+
113+
/**
114+
* @brief Returns an iterator that points to the first element of the
115+
* vector.
116+
* @return iterator that points to the first element
117+
*/
118+
auto begin() { return vec_.begin(); }
119+
120+
/**
121+
* @brief Returns an iterator that points to one element after the last
122+
* element of the vector.
123+
* @return iterator that points to one element after the last element
124+
*/
125+
auto end() { return vec_.end(); }
126+
89127
/**
90128
* @brief data accessor
91129
* @return pointer to data array
@@ -164,6 +202,13 @@ class AmiVector {
164202
*/
165203
void copy(const AmiVector &other);
166204

205+
/**
206+
* @brief Take absolute value (in-place)
207+
*/
208+
void abs() {
209+
N_VAbs(getNVector(), getNVector());
210+
};
211+
167212
private:
168213
/** main data storage */
169214
std::vector<realtype> vec_;
@@ -315,6 +360,32 @@ class AmiVectorArray {
315360
std::vector<N_Vector> nvec_array_;
316361
};
317362

363+
/**
364+
* @brief Computes z = a*x + b*y
365+
* @param a coefficient for x
366+
* @param x a vector
367+
* @param b coefficient for y
368+
* @param y another vector with same size as x
369+
* @param z result vector of same size as x and y
370+
*/
371+
inline void linearSum(realtype a, AmiVector const& x, realtype b,
372+
AmiVector const& y, AmiVector& z) {
373+
N_VLinearSum(a, const_cast<N_Vector>(x.getNVector()),
374+
b, const_cast<N_Vector>(y.getNVector()),
375+
z.getNVector());
376+
}
377+
378+
/**
379+
* @brief Compute dot product of x and y
380+
* @param x vector
381+
* @param y vector
382+
* @return dot product of x and y
383+
*/
384+
inline realtype dotProd(AmiVector const& x, AmiVector const& y) {
385+
return N_VDotProd(const_cast<N_Vector>(x.getNVector()),
386+
const_cast<N_Vector>(y.getNVector()));
387+
}
388+
318389
} // namespace amici
319390

320391

0 commit comments

Comments
 (0)