Namespace Array

namespace khivaarray

Functions

af::array khiva::arraycreateArray(void *data, unsigned ndims, dim_t *dims, const int type)

Creates an af::array.

Return
af::array Containing the data.
Parameters
  • data: Data used to create the af::array.
  • ndims: Number of dimensions of data.
  • dims: Cardinality of dimensions of data.
  • type: Data type.

void khiva::arraygetData(af::array array, void *data)

Retrieves the data from the device to the host.

Parameters
  • array: The Array that contains the data to be retrieved.
  • data: Pointer to a preallocated block of memory in the host.

af::dim4 khiva::arraygetDims(af::array array)

Returns the dimensions from a given array.

Return
af::dim4 The dimensions.
Parameters
  • array: Array from which to get the dimensions.

void khiva::arrayprint(af::array array)

Prints the content of an array.

Parameters
  • array: The array to be printed.

void khiva::arraydeleteArray(af_array array)

Decreases the references count for the given array.

Parameters
  • array: The Array to be deleted.

int khiva::arraygetType(af::array array)

Gets the type of the array.

Return
int Value of the Dtype enumeration.
Parameters
  • array: The array to obtain the type from.

template <typename T>
std::vector<int> khiva::arraygetRowsWithMaximals(khiva::array::Array<T> a)

Gets the indices of all rows containing a maximal.

Return
std::vector<int> with the indices of the rows with maximals.
Parameters
  • a: The input array.

template <typename T>
std::vector<int> khiva::arraygetIndexMaxColums(std::vector<T> r)

Gets the indices of the columns with maximals.

Return
std::vector<int> with the indices of the columns with maximals.
Parameters
  • r: The input row.

template <class T>
class khiva::arrayArray
#include </home/docs/checkouts/readthedocs.org/user_builds/khiva/checkouts/v0.1.0/include/khiva/array.h>

Array class, This class provides functionality manage Arrays on the host side.

Public Functions

khiva::array::ArrayArray()

Default Constructor of Array class.

khiva::array::ArrayArray(af::array in)

Constructor of Array class which receives and af::array.

Parameters
  • in: The input af::array.

khiva::array::Array~Array()

Default destructor of Array class.

void khiva::array::ArraysetNumX(int val)

Sets the cardinality of the first dimension.

Parameters
  • val: The value to be set.

void khiva::array::ArraysetNumY(int val)

Sets the cardinality of the second dimension.

Parameters
  • val: The value to be set.

void khiva::array::ArraysetNumW(int val)

Sets the cardinality of the third dimension.

Parameters
  • val: The value to be set.

void khiva::array::ArraysetNumZ(int val)

Sets the cardinality of the fourth dimension.

Parameters
  • val: The value to be set.

void khiva::array::ArraysetData(T *pd)

Sets the data to be stored in the Array.

Parameters
  • pd: The data to be stored.

int khiva::array::ArraygetNumX()

Gets the cardinality of the first dimension.

Return
int the Cardinality of the first dimension.

int khiva::array::ArraygetNumY()

Gets the cardinality of the second dimension.

Return
int the Cardinality of the second dimension.

int khiva::array::ArraygetNumW()

Gets the cardinality of the third dimension.

Return
int the Cardinality of the third dimension.

int khiva::array::ArraygetNumZ()

Gets the cardinality of the fourth dimension.

Return
int the Cardinality of the fourth dimension.

int khiva::array::ArraygetNumElements()

Gets the number of elements in data.

Return
int the Cardinality of the number of elements.

std::vector<T> khiva::array::ArraygetRow(int idx)

Gets the row number given by idx.

Return
std::vector Containing the selected row.
Parameters
  • idx: The row number to be extracted.

std::vector<T> khiva::array::ArraygetColumn(int idx)

Gets the column number given by idx.

Return
std::vector Containing the selected column.
Parameters
  • idx: The column number to be extracted.

T khiva::array::ArraygetElement(int row, int column)

Gets the element given by row and column.

Return
T The element to be extracted.
Parameters
  • row: The row number.
  • column: The column number.

T *khiva::array::ArraygetData()

Gets a pointer to the data stored in the array.

Return
T Pointer to data.

bool khiva::array::ArrayisEmpty()

Checks whether The Array is empty or not.

Return
True if the Array is empty, false otherwise.

void khiva::array::Arrayprint()

Prints the content of the array.