array.h File Reference


Detailed Description

Various array classes.

This file contains the three alloction classes

Todo:
Ensure that array_row works, either here or in src/ode/ode_it_solve_ts.cpp

Definition in file array.h.

#include <iostream>
#include <cmath>
#include <string>
#include <fstream>
#include <sstream>
#include <o2scl/err_hnd.h>
#include <gsl/gsl_ieee_utils.h>
#include <gsl/gsl_sort.h>

Go to the source code of this file.

Data Structures

class  array_alloc
 A simple class to provide an allocate() function for arrays. More...
class  array_2d_alloc
 A simple class to provide an allocate() function for 2-dimensional arrays. More...
class  pointer_alloc
 A simple class to provide an allocate() function for pointers. More...
class  pointer_2d_alloc
 A simple class to provide an allocate() function for pointers. More...
class  array_reverse
 A simple class which reverses the order of an array. More...
class  array_const_reverse
 A simple class which reverses the order of an array. More...
class  array_subvector
 A simple subvector class for an array (without error checking). More...
class  array_const_subvector
 A simple subvector class for a const array (without error checking). More...
class  array_subvector_reverse
 Reverse a subvector of an array. More...
class  array_const_subvector_reverse
 Reverse a subvector of a const array. More...
class  array_row
 Extract a row of a C-style 2d-array. More...

Functions

template<class vec_t>
int vector_out (std::ostream &os, size_t n, vec_t &v, bool endline=false)
 Output a vector to a stream.
template<class data_t, class vec_t>
void sort_downheap (vec_t &data, const size_t N, size_t k)
 Provide a downheap() function for vector_sort().
template<class data_t, class vec_t>
int vector_sort (const size_t n, vec_t &data)
 Sort a vector.
template<class data_t, class vec_t>
int vector_rotate (const size_t n, vec_t &data, size_t k)
 "Rotate" a vector so that the kth element is now the beginning
template<class data_t, class vec_t>
int vector_max (const size_t n, vec_t &data, data_t &max, size_t &ix)
 Compute the maximum of the first n elements of a vector.
template<class data_t, class vec_t>
int vector_min (const size_t n, vec_t &data, data_t &min, size_t &ix)
 Compute the minimum of the first n elements of a vector.
template<class data_t, class vec_t>
int vector_sum (const size_t n, vec_t &data, data_t &sum)
 Compute the sum of the first n elements of a vector.
template<class data_t, class vec_t>
int vector_avg (const size_t n, vec_t &data, data_t &avg)
 Compute the average of the first n elements of a vector.
template<class data_t, class vec_t>
int vector_variance (const size_t n, vec_t &data, data_t &mean, data_t &var)
 Compute the variance of the first n elements of a vector given the mean mean.
template<class data_t, class vec_t>
int vector_reverse (const size_t n, vec_t &data)
 Reverse a vector.
template<class data_t, class vec_t>
int vector_stdev (const size_t n, vec_t &data, data_t &var)
 Compute the standard deviation of the first n elements of a vector.


Function Documentation

int vector_avg ( const size_t  n,
vec_t &  data,
data_t &  avg 
) [inline]

Compute the average of the first n elements of a vector.

If n is zero, this will set avg to zero and return gsl_success.

Definition at line 526 of file array.h.

int vector_out ( std::ostream &  os,
size_t  n,
vec_t &  v,
bool  endline = false 
) [inline]

Output a vector to a stream.

No trailing space is output after the last element, and an endline is output only if endline is set to true. If the parameter n is zero, this function silently does nothing.

Definition at line 395 of file array.h.

int vector_sum ( const size_t  n,
vec_t &  data,
data_t &  sum 
) [inline]

Compute the sum of the first n elements of a vector.

If n is zero, this will set avg to zero and return gsl_success.

Definition at line 510 of file array.h.

int vector_variance ( const size_t  n,
vec_t &  data,
data_t &  mean,
data_t &  var 
) [inline]

Compute the variance of the first n elements of a vector given the mean mean.

If n is zero, this will set avg to zero and return gsl_success.

Definition at line 543 of file array.h.


Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page