diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 0ba0ae0049..fd52334e62 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -1,6 +1,27 @@ Release Notes {#releasenotes} ============== +v3.1.1 +============== + +Installers +----------- + +* CUDA backend now depends on CUDA 7.5 toolkit +* OpenCL backend now require OpenCL 1.2 or greater + +Bug Fixes +-------------- + +* Fixed [bug](https://github.com/arrayfire/arrayfire/issues/981) in reductions after indexing +* Fixed [bug](https://github.com/arrayfire/arrayfire/issues/976) in indexing when using reverse indices + +Build +------ + +* `cmake` now includes `PKG_CONFIG` in the search path for CBLAS and LAPACKE libraries +* `heston_model` example now builds with the default ArrayFire cmake files after installation + v3.1.0 ============== @@ -105,7 +126,7 @@ Bug Fixes * Fix compatibility of c32/c64 arrays when operating with scalars * Fix median for all values of an array * Fix double free issue when indexing (30cbbc7) - * Fix bug in rank + * Fix [bug](https://github.com/arrayfire/arrayfire/issues/901) in rank * Fix default values for scale throwing exception * Fix conjg raising exception on real input * Fix bug when using conjugate transpose for vector input @@ -115,7 +136,7 @@ Bug Fixes * Fix setSeed for randu * Fix casting to and from complex * Check NULL values when allocating memory - * Fix offset issue for CPU element-wise operations + * Fix [offset issue](https://github.com/arrayfire/arrayfire/issues/923) for CPU element-wise operations New Examples ------------ @@ -123,12 +144,10 @@ New Examples * Susan * Heston Model (contributed by Michael Nowotny) -Distribution Changes --------------------- -* Fixed automatic detection of ArrayFire when using with CMake in the Windows - Installer -* Compiling ArrayFire with FreeImage as a static library for Linux x86 - installers +Installer +---------- +* Fixed bug in automatic detection of ArrayFire when using with CMake in Windows +* The Linux libraries are now compiled with static version of FreeImage Known Issues ------------ diff --git a/examples/financial/heston_model.cpp b/examples/financial/heston_model.cpp index 617e04be05..581f89994e 100644 --- a/examples/financial/heston_model.cpp +++ b/examples/financial/heston_model.cpp @@ -29,22 +29,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************************************/ +#include #include #include -#include -#include using namespace std; using namespace af; -tuple -simulateHestonModel(float T, unsigned int N, unsigned int R, float mu, float kappa, - float vBar, float sigmaV, float rho, float x0, float v0) +void simulateHestonModel(af::array &xres, af::array &vres, + float T, unsigned int N, unsigned int R, float mu, float kappa, + float vBar, float sigmaV, float rho, float x0, float v0) { float deltaT = T / (float)(N - 1); - std::vector x = {af::constant(x0, R), af::constant(0, R)}; - std::vector v = {af::constant(v0, R), af::constant(0, R)}; + af::array x[] = {af::constant(x0, R), af::constant(0, R)}; + af::array v[] = {af::constant(v0, R), af::constant(0, R)}; float sqrtDeltaT = sqrt(deltaT); @@ -68,7 +67,8 @@ simulateHestonModel(float T, unsigned int N, unsigned int R, float mu, float kap v[tCurrent] = max(vTmp, zeroConstant); } - return std::make_tuple(x[tCurrent], v[tCurrent]); + xres = x[tCurrent]; + vres = v[tCurrent]; } int main() @@ -94,11 +94,11 @@ int main() af::array v; // first run - std::tie(x, v) = simulateHestonModel(T, nT, R_first_run, r, kappa, vBar, sigmaV, rho, x0, v0); + simulateHestonModel(x, v, T, nT, R_first_run, r, kappa, vBar, sigmaV, rho, x0, v0); af::sync(); // Ensure the first run is finished timer::start(); - std::tie(x, v) = simulateHestonModel(T, nT, R, r, kappa, vBar, sigmaV, rho, x0, v0); + simulateHestonModel(x, v, T, nT, R, r, kappa, vBar, sigmaV, rho, x0, v0); af::sync(); cout << "Time in simulation: " << timer::stop() << endl; diff --git a/src/api/cpp/array.cpp b/src/api/cpp/array.cpp index 7615c39b5a..3280457e19 100644 --- a/src/api/cpp/array.cpp +++ b/src/api/cpp/array.cpp @@ -374,8 +374,7 @@ namespace af const array::array_proxy array::row(int index) const { - seq idx(index, index, 1); - return this->operator()(idx, span, span, span); + return this->operator()(index, span, span, span); } array::array_proxy array::row(int index) @@ -385,8 +384,7 @@ namespace af const array::array_proxy array::col(int index) const { - seq idx(index, index, 1); - return this->operator()(span, idx, span, span); + return this->operator()(span, index, span, span); } array::array_proxy array::col(int index) @@ -396,8 +394,7 @@ namespace af const array::array_proxy array::slice(int index) const { - seq idx(index, index, 1); - return this->operator()(span, span, idx, span); + return this->operator()(span, span, index, span); } array::array_proxy array::slice(int index) diff --git a/src/api/cpp/index.cpp b/src/api/cpp/index.cpp index ccc698bc3c..d7a0cd1c76 100644 --- a/src/api/cpp/index.cpp +++ b/src/api/cpp/index.cpp @@ -75,7 +75,7 @@ index::index(const af::array& idx0) { impl.isBatch = false; } -index::index(const af::index& idx0) { +index::index(const af::index& idx0) { *this = idx0; } diff --git a/src/api/cpp/seq.cpp b/src/api/cpp/seq.cpp index d1433563ba..a9d5df637e 100644 --- a/src/api/cpp/seq.cpp +++ b/src/api/cpp/seq.cpp @@ -46,7 +46,7 @@ seq::~seq() seq::seq(double n): m_gfor(false) { if (n < 0) { - init(n + 1, 0, 1); // seq(-4) = -3, -2, -1, 0 + init(0, n, 1); } else { init(0, n - 1, 1); } @@ -65,10 +65,6 @@ seq& seq::operator=(const af_seq& s_) seq::seq(double begin, double end, double step): m_gfor(false) { - if(begin == -1 && end <= -1) { - step = 0; // end - } - if (step == 0) { if (begin != end) // Span AF_THROW_MSG("Invalid step size", AF_ERR_ARG); diff --git a/src/backend/dim4.cpp b/src/backend/dim4.cpp index 41ea56a336..d1f69d2044 100644 --- a/src/backend/dim4.cpp +++ b/src/backend/dim4.cpp @@ -176,7 +176,7 @@ dim4 operator*(const dim4& first, const dim4& second) bool -isEnd(const af_seq &seq) { return (seq.end <= -1); } +hasEnd(const af_seq &seq) { return (seq.begin <= -1 || seq.end <= -1); } bool isSpan(const af_seq &seq) { return (seq.step == 0 && seq.begin == 1 && seq.end == 1); } @@ -196,18 +196,11 @@ dim_t calcDim(const af_seq &seq, const dim_t &parentDim) dim_t outDim = 1; if (isSpan(seq)) { outDim = parentDim; - } else if (isEnd(seq)) { - if(seq.begin == -1) { // only end is passed as seq - outDim = 1; - } else if (seq.begin < 0) { - af_seq temp = {parentDim + seq.begin, - parentDim + seq.end, - seq.step}; - outDim = seqElements(temp); - } else { // end is passed as a part of seq - af_seq temp = {seq.begin, parentDim + seq.end, seq.step}; - outDim = seqElements(temp); - } + } else if (hasEnd(seq)) { + af_seq temp = {seq.begin, seq.end, seq.step}; + if (seq.begin < 0) temp.begin += parentDim; + if (seq.end < 0) temp.end += parentDim; + outDim = seqElements(temp); } else { DIM_ASSERT(1, seq.begin >= -DBL_MIN && seq.begin < parentDim); DIM_ASSERT(1, seq.end < parentDim); @@ -216,7 +209,8 @@ dim_t calcDim(const af_seq &seq, const dim_t &parentDim) return outDim; } -} + +} // end namespace af using af::dim4; using std::vector;