/******************************************************* * Copyright (c) 2014, ArrayFire * All rights reserved. * * This file is distributed under 3-clause BSD license. * The complete license agreement can be obtained at: * http://arrayfire.com/licenses/BSD-3-Clause ********************************************************/ #include // header with cpu backend specific // Array class implementation that inherits // ArrayInfo base class #include // cpu backend function header #include // Function implementation header #include // error check functions and Macros // specific to cpu backend #include #include using af::dim4; namespace cpu { template Array exampleFunction(const Array &a, const Array &b, const af_someenum_t method) { dim4 outputDims; // this should be '= in.dims();' in most cases // but would definitely depend on the type of // algorithm you are implementing. Array out = createEmptyArray(outputDims); // Please use the create***Array helper // functions defined in Array.hpp to create // different types of Arrays. Please check the // file to know what are the different types you // can create. // Enqueue the function call on the worker thread // This code will be present in src/backend/cpu/kernel/exampleFunction.hpp getQueue().enqueue(kernel::exampleFunction, out, a, b, method); return out; // return the result } #define INSTANTIATE(T) \ template Array exampleFunction(const Array &a, const Array &b, \ const af_someenum_t method); // INSTANTIATIONS for all the types which // are present in the switch case statement // in src/api/c/exampleFunction.cpp should be available INSTANTIATE(float) INSTANTIATE(double) INSTANTIATE(int) INSTANTIATE(uint) INSTANTIATE(uchar) INSTANTIATE(char) INSTANTIATE(cfloat) INSTANTIATE(cdouble) } // namespace cpu