A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.arrayfire.org/docs/getting_started_2convolve_8cpp-example.htm below:

ArrayFire: getting_started/convolve.cpp

#include <stdio.h>

#include <cstdlib>

static float h_dx[] = {1.f / 12, -8.f / 12, 0, 8.f / 12,

-1.f / 12};

static float h_spread[] = {1.f / 5, 1.f / 5, 1.f / 5, 1.f / 5, 1.f / 5};

static array

dx, spread, kernel;

static array

full_out, dsep_out, hsep_out;

static void

full() { full_out =

convolve2

(img, kernel); }

static void

dsep() { dsep_out =

convolve

(dx, spread, img); }

return

(max<float>(

abs

(left - right)) > 1e-6);

}

int main(int argc, char **argv) {

try {

int device = argc > 1 ? atoi(argv[1]) : 0;

spread =

array

(1, 5, h_spread);

printf(

"full 2D convolution: %.5f seconds\n"

,

timeit

(full));

printf(

"separable, device pointers: %.5f seconds\n"

,

timeit

(dsep));

if

(fail(full_out, dsep_out)) {

throw af::exception

(

"full != dsep"

); }

return 0;

}

A multi dimensional data container.

An ArrayFire exception class.

virtual const char * what() const

Returns an error message for the exception in a string format.

AFAPI array abs(const array &in)

C++ Interface to calculate the absolute value.

AFAPI array matmul(const array &lhs, const array &rhs, const matProp optLhs=AF_MAT_NONE, const matProp optRhs=AF_MAT_NONE)

C++ Interface to multiply two matrices.

AFAPI void setDevice(const int device)

Sets the current device.

AFAPI array randu(const dim4 &dims, const dtype ty, randomEngine &r)

C++ Interface to create an array of random numbers uniformly distributed.

AFAPI array convolve2(const array &signal, const array &filter, const convMode mode=AF_CONV_DEFAULT, const convDomain domain=AF_CONV_AUTO)

C++ Interface for convolution on two dimensional signals.

AFAPI array convolve(const array &signal, const array &filter, const convMode mode=AF_CONV_DEFAULT, const convDomain domain=AF_CONV_AUTO)

C++ Interface for convolution any(one through three) dimensional signals.

AFAPI double timeit(void(*fn)())


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4