Simple array data objects

Simple array data objects — Data objects based on simple arrays.

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── BData
            ├── BMatrix
               ╰── BValMatrix
            ├── BScalar
               ╰── BValScalar
            ╰── BVector
                ╰── BValVector

Description

Data classes BValScalar, BValVector, and BValMatrix. These are the trivial implementations of the abstract data classes BScalar, BVector, and BMatrix.

In these objects, an array (or, in the case of a BValScalar, a single double precision value) is maintained that also serves as the data cache. Therefore, this array should not be freed.

The get_values() methods can be used to get a const version of the array. To get a modifiable version, use the get_array() methods for BValVector and BValMatrix.

Functions

b_val_scalar_new ()

BData *
b_val_scalar_new (double val);

Creates a new BValScalar object.

Parameters

val

initial value

 

Returns

The new object.

[transfer full]


b_val_scalar_get_val ()

double *
b_val_scalar_get_val (BValScalar *s);

Gets a pointer to the value of a BValScalar.

Parameters

s

a BValScalar

 

Returns

A pointer to the scalar value.

[transfer none]


b_val_scalar_set_val ()

void
b_val_scalar_set_val (BValScalar *s,
                      double val);

Sets the value of a BValScalar.

Parameters

s

a BValScalar

 

val

the value

 

b_val_vector_new ()

BData *
b_val_vector_new (double *val,
                  guint n,
                  GDestroyNotify notify);

Create a new BValVector from an existing array.

[skip]

Parameters

val

array of doubles.

[array length=n]

n

length of array

 

notify

the function to be called to free the array when the BData is unreferenced, or NULL.

[nullable]

Returns

a BData


b_val_vector_new_alloc ()

BData *
b_val_vector_new_alloc (guint n);

Create a new BValVector of length n , initialized to zeros.

Parameters

n

length of array

 

Returns

a BData


b_val_vector_new_copy ()

BData *
b_val_vector_new_copy (const double *val,
                       guint n);

Create a new BValVector, copying from an existing array.

Parameters

val

array of doubles.

[array length=n]

n

length of array

 

Returns

a BData


b_val_vector_get_array ()

double *
b_val_vector_get_array (BValVector *s);

Get the array of values of vec .

Parameters

s

BValVector

 

Returns

an array. Should not be freed.


b_val_vector_replace_array ()

void
b_val_vector_replace_array (BValVector *s,
                            double *array,
                            guint n,
                            GDestroyNotify notify);

Replace the array of values of s .

Parameters

s

BValVector

 

array

array of doubles.

[array length=n]

n

length of array

 

notify

the function to be called to free the array when the BData is unreferenced, or NULL.

[nullable]

b_val_matrix_new ()

BData *
b_val_matrix_new (double *val,
                  guint rows,
                  guint columns,
                  GDestroyNotify notify);

Create a new BValMatrix using an existing array.

[skip]

Parameters

val

array of doubles

 

rows

number of rows

 

columns

number of columns

 

notify

the function to be called to free the array when the BData is unreferenced, or NULL.

[nullable]

Returns

a BData


b_val_matrix_new_alloc ()

BData *
b_val_matrix_new_alloc (guint rows,
                        guint columns);

Allocate a new array with rows rows and columns columns and use it in a new BValMatrix.

Parameters

rows

number of rows

 

columns

number of columns

 

Returns

a BData


b_val_matrix_new_copy ()

BData *
b_val_matrix_new_copy (const double *val,
                       guint rows,
                       guint columns);

Create a new BValMatrix, copying from an existing array.

Parameters

val

array of doubles with at least rows *columns elements

 

rows

number of rows

 

columns

number of columns

 

Returns

a BData


b_val_matrix_get_array ()

double *
b_val_matrix_get_array (BValMatrix *s);

Get the array of values of s .

Parameters

s

BValVector

 

Returns

an array. Should not be freed.


b_val_matrix_replace_array ()

void
b_val_matrix_replace_array (BValMatrix *s,
                            double *array,
                            guint rows,
                            guint columns,
                            GDestroyNotify notify);

Get the array of values of s .

[skip]

Parameters

s

BValMatrix

 

array

array of doubles

 

rows

number of rows

 

columns

number of columns

 

notify

the function to be called to free the array when the BData is unreferenced, or NULL.

[nullable]

Types and Values

BValMatrix

typedef struct _BValMatrix BValMatrix;

Object holding a two-dimensional array of double precision numbers.


BValScalar

typedef struct _BValScalar BValScalar;

Object holding a single double precision number.


BValVector

typedef struct _BValVector BValVector;

Object holding a one-dimensional array of double precision numbers.