26 #include <tensor/refcount.h>
27 #include <tensor/sdf.h>
34 Job(
int argc,
const char **argv);
36 tensor::index number_of_jobs()
const {
return number_of_jobs_; };
37 tensor::index current_job()
const {
return this_job_; };
41 double get_value_with_default(
const std::string &variable,
double def)
const;
42 double get_value(
const std::string &variable)
const;
43 void dump_variables(sdf::OutDataFile &file)
const;
45 typedef tensor::shared_ptr<sdf::OutDataFile> dataset;
46 dataset open_dataset(
const std::string &filename)
const;
47 bool dataset_record_exists(
const std::string &filename)
const;
52 Variable(
const std::string name,
double min,
double max, tensor::index n = 10) :
53 name_(name), values_(tensor::
linspace(min, max, n)), which_(0)
56 name_(
""), values_(), which_(0)
59 const std::string &name()
const {
return name_; }
61 tensor::index size()
const {
return values_.
size(); }
62 void select(tensor::index i) { which_ = i; }
63 double value()
const {
return values_[which_]; }
71 typedef std::vector<Variable> var_list;
73 static const Variable no_variable;
74 std::string filename_;
76 tensor::index number_of_jobs_;
77 tensor::index this_job_, first_job_, last_job_;
79 const Variable *find_variable(
const std::string &name)
const;
80 static const Variable parse_line(
const std::string &s);
81 static int parse_file(std::istream &s, std::vector<Variable> &data);
82 tensor::index compute_number_of_jobs()
const;
83 void select_job(tensor::index which);
88 #endif // ! TENSOR_JOBS_H
const RTensor linspace(double min, double max, index n=100)
Vector of 'n' equally spaced numbers in the interval [min, max].
Real Tensor with elements of type "double".
index size() const
Returns total number of elements in Tensor.