Function mult_vector_spec (o2scl_hdf)

O2scl : Function List

template<class vec_t>
int o2scl_hdf::mult_vector_spec(std::string spec, std::vector<vec_t> &v, bool use_regex = false, int verbose = 0, bool err_on_fail = true)

A list of vectors specified by a string.

Some acol commands take arguments which are ‘multiple vector specifications’, i.e. a set of arrays specified as a string. The different parts of the string are separated by a colon, and the first part specifes the type of multiple vector specification. The different types are:

  1. func:<N>:<function of i>:<function of i and j> - Specify the number of vectors, a function of “i” which determines the length of the ith vector, and a function of “i” and “j” which specifies the jth element of the ith vector.

  2. text:<filename pattern>:<numeric column list> - Read one or more text files and extract vectors of numbers from columns of the text file, ignoring any header rows which contain non-numeric values. For example ‘text:~/temp.dat:2-4’ will construct vectors from the third, fourth, and fifth columns of the file ‘temp.dat’ in the user’s home directory.

  3. hdf5:<filename pattern>:<object name>:[additional spec.] - Read one or more HDF5 files and obtain a vector from the object with the specified name. The remaining parts of the string contain additional information which may be needed depending on the type of object stored in the HDF5 file. type: addl. spec.

table:<column pattern> table:<row list>:<column pattern>

Also, many normal vector specifications (from ‘acol -help vector-spec’) also work as multiple vector specifications. These include specifications which begin with ‘val:’, ‘list:’, ‘grid:’, and ‘table-row:’. Also included are ‘hdf5:’ specifications which refer to objects of type double, double[], hist, int, int[], size_t, size_t[], and uniform_grid<double>.

End of runtime documentation.

Used in o2scl_acol_mult_vectors_to_conts() which is used in o2graph plotv . Used in acol create table-mv.

Idea for Future:

When hdf5 is a single vector spec, it has to close the file so that vector_spec() can open it again. This should be fixed. Maybe the way to improve this is to break it up into several functions.

Note

The vector v is not cleared and new vector specified in spec are added to the end of v.

Warning

Experimental.

std::vector<std::vector<double>> o2scl_hdf::mult_vector_spec(std::string spec)

Convert a vector specification to a std::vector.