Namespace Array

namespace array

Functions

af::array createArray(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 deleteArray(af_array array)

Decreases the references count for the given array.

Parameters
  • array: The Array to be deleted.

void getData(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 getDims(af::array array)

Returns the dimensions from a given array.

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

int getType(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.

af::array join(int dim, af::array first, af::array second)

Joins the first and second arrays along the specified dimension.

Return
af::array The result of joining first and second along the specified dimension.
Parameters
  • dim: The dimension along which the join occurs.
  • first: The first input array.
  • second: The second input array.

void print(af::array array)

Prints the content of an array.

Parameters
  • array: The array to be printed.

template <typename T>
std::vector<int> getRowsWithMaximals(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> getIndexMaxColums(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 Array
#include </home/docs/checkouts/readthedocs.org/user_builds/khiva/checkouts/v0.2.3/include/khiva/array.h>

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

Public Functions

Array()

Default Constructor of Array class.

Array(af::array in)

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

Parameters
  • in: The input af::array.

~Array()

Default destructor of Array class.

void setNumX(int val)

Sets the cardinality of the first dimension.

Parameters
  • val: The value to be set.

void setNumY(int val)

Sets the cardinality of the second dimension.

Parameters
  • val: The value to be set.

void setNumW(int val)

Sets the cardinality of the third dimension.

Parameters
  • val: The value to be set.

void setNumZ(int val)

Sets the cardinality of the fourth dimension.

Parameters
  • val: The value to be set.

void setData(T *pd)

Sets the data to be stored in the Array.

Parameters
  • pd: The data to be stored.

int getNumX()

Gets the cardinality of the first dimension.

Return
int the Cardinality of the first dimension.

int getNumY()

Gets the cardinality of the second dimension.

Return
int the Cardinality of the second dimension.

int getNumW()

Gets the cardinality of the third dimension.

Return
int the Cardinality of the third dimension.

int getNumZ()

Gets the cardinality of the fourth dimension.

Return
int the Cardinality of the fourth dimension.

int getNumElements()

Gets the number of elements in data.

Return
int the Cardinality of the number of elements.

std::vector<T> getRow(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> getColumn(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 getElement(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 *getData()

Gets a pointer to the data stored in the array.

Return
T Pointer to data.

bool isEmpty()

Checks whether The Array is empty or not.

Return
True if the Array is empty, false otherwise.

void print()

Prints the content of the array.