GArrowTensor

GArrowTensor — Tensor class

Functions

Properties

GArrowBuffer * buffer Read / Write / Construct Only
gpointer tensor Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── GArrowTensor

Includes

#include <arrow-glib/arrow-glib.h>

Description

GArrowTensor is a tensor class.

Functions

garrow_tensor_new ()

GArrowTensor *
garrow_tensor_new (GArrowDataType *data_type,
                   GArrowBuffer *data,
                   gint64 *shape,
                   gsize n_dimensions,
                   gint64 *strides,
                   gsize n_strides,
                   gchar **dimension_names,
                   gsize n_dimension_names);

Parameters

data_type

A GArrowDataType that indicates each element type in the tensor.

 

data

A GArrowBuffer that contains tensor data.

 

shape

A list of dimension sizes.

[array length=n_dimensions]

n_dimensions

The number of dimensions.

 

strides

A list of the number of bytes in each dimension.

[array length=n_strides][nullable]

n_strides

The number of strides.

 

dimension_names

A list of dimension names.

[array length=n_dimension_names][nullable]

n_dimension_names

A list of dimension names

 

Returns

The newly created GArrowTensor.

Since: 0.3.0


garrow_tensor_equal ()

gboolean
garrow_tensor_equal (GArrowTensor *tensor,
                     GArrowTensor *other_tensor);

Parameters

tensor

A GArrowTensor.

 

other_tensor

A GArrowTensor to be compared.

 

Returns

TRUE if both of them have the same data, FALSE otherwise.

Since: 0.4.0


garrow_tensor_get_value_data_type ()

GArrowDataType *
garrow_tensor_get_value_data_type (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

The data type of each value in the tensor.

[transfer full]

Since: 0.3.0


garrow_tensor_get_value_type ()

GArrowType
garrow_tensor_get_value_type (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

The type of each value in the tensor.

Since: 0.3.0


garrow_tensor_get_buffer ()

GArrowBuffer *
garrow_tensor_get_buffer (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

The data of the tensor.

[transfer full]

Since: 0.3.0


garrow_tensor_get_shape ()

gint64 *
garrow_tensor_get_shape (GArrowTensor *tensor,
                         gint *n_dimensions);

Parameters

tensor

A GArrowTensor.

 

n_dimensions

The number of dimensions.

[out]

Returns

The shape of the tensor.

It should be freed with g_free() when no longer needed.

[array length=n_dimensions][transfer full]

Since: 0.3.0


garrow_tensor_get_strides ()

gint64 *
garrow_tensor_get_strides (GArrowTensor *tensor,
                           gint *n_strides);

Parameters

tensor

A GArrowTensor.

 

n_strides

The number of strides.

[out]

Returns

The strides of the tensor.

It should be freed with g_free() when no longer needed.

[array length=n_strides][transfer full]

Since: 0.3.0


garrow_tensor_get_n_dimensions ()

gint
garrow_tensor_get_n_dimensions (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

The number of dimensions of the tensor.

Since: 0.3.0


garrow_tensor_get_dimension_name ()

const gchar *
garrow_tensor_get_dimension_name (GArrowTensor *tensor,
                                  gint i);

Parameters

tensor

A GArrowTensor.

 

i

The index of the target dimension.

 

Returns

The i-th dimension name of the tensor.

Since: 0.3.0


garrow_tensor_get_size ()

gint64
garrow_tensor_get_size (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

The number of value cells in the tensor.

Since: 0.3.0


garrow_tensor_is_mutable ()

gboolean
garrow_tensor_is_mutable (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

TRUE if the tensor is mutable, FALSE otherwise.

Since: 0.3.0


garrow_tensor_is_contiguous ()

gboolean
garrow_tensor_is_contiguous (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

TRUE if the tensor is contiguous, FALSE otherwise.

Since: 0.3.0


garrow_tensor_is_row_major ()

gboolean
garrow_tensor_is_row_major (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

TRUE if the tensor is row major a.k.a. C order, FALSE otherwise.

Since: 0.3.0


garrow_tensor_is_column_major ()

gboolean
garrow_tensor_is_column_major (GArrowTensor *tensor);

Parameters

tensor

A GArrowTensor.

 

Returns

TRUE if the tensor is column major a.k.a. Fortran order, FALSE otherwise.

Since: 0.3.0

Types and Values

GARROW_TYPE_TENSOR

#define GARROW_TYPE_TENSOR (garrow_tensor_get_type())

struct GArrowTensorClass

struct GArrowTensorClass {
  GObjectClass parent_class;
};

GArrowTensor

typedef struct _GArrowTensor GArrowTensor;

Property Details

The “buffer” property

  “buffer”                   GArrowBuffer *

The data.

Owner: GArrowTensor

Flags: Read / Write / Construct Only


The “tensor” property

  “tensor”                   gpointer

The raw std::shared<arrow::Tensor> *.

Owner: GArrowTensor

Flags: Write / Construct Only