Next: , Previous: , Up: Top   [Contents][Index]


2 Functions

The functions marray_f work with elements of type double.

There are other versions of the form marray_TYPE_f where TYPE is any of:

Allocation

Function: marray * marray_alloc (const unsigned int rank, const size_t * dimension);

Allocate memory for a marray of rank rank and dimensions given in dimension (an array of size rank), and return a pointer to its position in memory.

Function: marray * marray_calloc (const unsigned int rank, const size_t * dimension);

Allocate memory for a marray of rank rank and dimensions given in dimension (an array of size rank), set all its elements to 0 and return a pointer to its position in memory.

Function: marray * marray_copy (marray * t);

Create a copy of marray t and return a pointer to its position in memory.

Function: void marray_free (marray * t);

Release the memory used by marray t.

Conversion

Function: gsl_matrix * marray_2matrix (marray * t);

Convert a rank 2 marray to a gsl_matrix.

Function: gsl_vector * marray_2vector (marray * t);

Convert a rank 1 marray to a gsl_vector.

Get/Set elements

Function: double marray_get (const marray * t, const size_t * indices);

t[indices]

Function: void marray_set (marray * t, const size_t * indices, const double x);

t[indices] = x

Access pointer

Function: double * marray_ptr (marray * t, const size_t * indices);

&t[indices]

Function: const double * marray_const_ptr (const marray * t, const size_t * indices);

&t[indices] (const pointer)

Set to a value

Function: void marray_set_zero (marray * t);

t = 0

Function: void marray_set_all (marray * t, double x);

t = x

IO

Function: int marray_fread (FILE * stream, marray * t);

Read binary representation of marray from stream and save it in t.

Function: int marray_fwrite (FILE * stream, const marray * t);

Write binary representation of marray t to stream.

Function: int marray_fscanf (FILE * stream, marray * t);

Read text representation of marray from stream and save it in t.

Function: int marray_fprintf (FILE * stream, const marray * t, const char * format);

Write text representation of marray t to stream, using format format for its elements.

Copy

Function: int marray_memcpy (marray * dest, const marray * src);

dest = src

Function: int marray_swap (marray * t1, marray * t2);

t1, t2 = t2, t1

Maxima

Function: double marray_max (const marray * t);

Maximum element of marray t.

Function: double marray_min (const marray * t);

Minimum element of marray t.

Function: void marray_minmax (const marray * t, double * min_out, double * max_out);

Copy the minimum and maximum elements of t in min_out and max_out respectively.

Function: void marray_max_index (const marray * t, size_t * indices);

Get the indices of the maximum element of t.

Function: void marray_min_index (const marray * t, size_t * indices);

Get the indices of the minimum element of t.

Function: void marray_minmax_index (const marray * t, size_t * imin, size_t * imax);

Get the indices of the minimum and maximum elements of t.

Properties

Function: int marray_isnull (const marray * t);

t == 0

Operations

Function: int marray_add (marray * a, const marray * b);

a += b

Function: int marray_sub (marray * a, const marray * b);

a -= b

Function: int marray_mul_elements (marray * a, const marray * b);

a .*= b

Function: int marray_div_elements (marray * a, const marray * b);

a ./= b

Function: int marray_scale (marray * a, const double x);

a *= x

Function: int marray_add_constant (marray * a, const double x);

a += x


Next: , Previous: , Up: Top   [Contents][Index]