Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions docs/pages/release_notes.md
Original file line number Diff line number Diff line change
@@ -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
==============

Expand Down Expand Up @@ -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
Expand All @@ -115,20 +136,18 @@ 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
------------
* Match Template
* 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
------------
Expand Down
20 changes: 10 additions & 10 deletions examples/financial/heston_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,21 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************/

#include <stdio.h>
#include <iostream>
#include <arrayfire.h>
#include <vector>
#include <tuple>

using namespace std;
using namespace af;

tuple<af::array, af::array>
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<af::array> x = {af::constant(x0, R), af::constant(0, R)};
std::vector<af::array> 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);

Expand All @@ -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()
Expand All @@ -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;

Expand Down
9 changes: 3 additions & 6 deletions src/api/cpp/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/api/cpp/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 1 addition & 5 deletions src/api/cpp/seq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down
22 changes: 8 additions & 14 deletions src/backend/dim4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand All @@ -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);
Expand All @@ -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;
Expand Down