本文整理汇总了C++中Series类的典型用法代码示例。如果您正苦于以下问题:C++ Series类的具体用法?C++ Series怎么用?C++ Series使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Series类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: builder
// Builds a network with a network_spec in the network description
// language, to recognize a character set of num_outputs size.
// If append_index is non-negative, then *network must be non-null and the
// given network_spec will be appended to *network AFTER append_index, with
// the top of the input *network discarded.
// Note that network_spec is call by value to allow a non-const char* pointer
// into the string for BuildFromString.
// net_flags control network behavior according to the NetworkFlags enum.
// The resulting network is returned via **network.
// Returns false if something failed.
bool NetworkBuilder::InitNetwork(int num_outputs, STRING network_spec,
int append_index, int net_flags,
float weight_range, TRand* randomizer,
Network** network) {
NetworkBuilder builder(num_outputs);
Series* bottom_series = NULL;
StaticShape input_shape;
if (append_index >= 0) {
// Split the current network after the given append_index.
ASSERT_HOST(*network != NULL && (*network)->type() == NT_SERIES);
Series* series = reinterpret_cast<Series*>(*network);
Series* top_series = NULL;
series->SplitAt(append_index, &bottom_series, &top_series);
if (bottom_series == NULL || top_series == NULL) {
tprintf("Yikes! Splitting current network failed!!\n");
return false;
}
input_shape = bottom_series->OutputShape(input_shape);
delete top_series;
}
char* str_ptr = &network_spec[0];
*network = builder.BuildFromString(input_shape, &str_ptr);
if (*network == NULL) return false;
(*network)->SetNetworkFlags(net_flags);
(*network)->InitWeights(weight_range, randomizer);
(*network)->SetupNeedsBackprop(false);
if (bottom_series != NULL) {
bottom_series->AppendSeries(*network);
*network = bottom_series;
}
(*network)->CacheXScaleFactor((*network)->XScaleFactor());
return true;
}
示例2: Plot
bool TestPlotWithArea::DoTest()
{
Plot *plot;
plot = new Plot();
Area *area = new Area2D();
Box *box1, *box2;
box1 = new Box(plot);
box2 = new Box(plot);
Series *series;
series = new Series2D("Series");
DataTyped<int> *xdata;
xdata = new DataTyped<int>();
series->SetData(xdata, AXIS_X);
area->AddSeries(series);
plot->AddArea(area);
delete box1;
delete plot;
return true;
}
示例3: NonLinearity
// Parses a network that begins with 'C'.
Network* NetworkBuilder::ParseC(const StaticShape& input_shape, char** str) {
NetworkType type = NonLinearity((*str)[1]);
if (type == NT_NONE) {
tprintf("Invalid nonlinearity on C-spec!: %s\n", *str);
return nullptr;
}
int y = 0, x = 0, d = 0;
if ((y = strtol(*str + 2, str, 10)) <= 0 || **str != ',' ||
(x = strtol(*str + 1, str, 10)) <= 0 || **str != ',' ||
(d = strtol(*str + 1, str, 10)) <= 0) {
tprintf("Invalid C spec!:%s\n", *str);
return nullptr;
}
if (x == 1 && y == 1) {
// No actual convolution. Just a FullyConnected on the current depth, to
// be slid over all batch,y,x.
return new FullyConnected("Conv1x1", input_shape.depth(), d, type);
}
Series* series = new Series("ConvSeries");
Convolve* convolve =
new Convolve("Convolve", input_shape.depth(), x / 2, y / 2);
series->AddToStack(convolve);
StaticShape fc_input = convolve->OutputShape(input_shape);
series->AddToStack(new FullyConnected("ConvNL", fc_input.depth(), d, type));
return series;
}
示例4: readData
void readData()
{
//percorrendo
list<double>::iterator it;
for(int i = 0; i < mySeries.size(); i++)
{
cout <<"serie " << i<<endl;
for(it = mySeries[i].begin(); it != mySeries[i].end(); it++)
{
cout << *it << " ";
}
cout << endl;
}
for(int i = 0; i < templateSeries.size(); i++)
{
cout <<"serie " << i<<endl;
for(it = templateSeries[i].begin(); it != templateSeries[i].end(); it++)
{
cout << *it << " ";
}
cout << endl;
}
}
示例5: SoundFileSource
void
Talk::cmd_load(mrs_string fname, mrs_natural lineSize)
{
cout << "cmd_load called" << endl;
src_ = new SoundFileSource("src");
src_->updControl("mrs_string/filename", fname);
fname_ = fname;
src_->updControl("mrs_natural/inSamples", lineSize);
AbsMax* absmax = new AbsMax("absmax");
Series *series = new Series("plot");
series->addMarSystem(src_);
series->addMarSystem(absmax);
mrs_natural hops = src_->getctrl("mrs_natural/size")->to<mrs_natural>() * src_->getctrl("mrs_natural/nChannels")->to<mrs_natural>() / src_->getctrl("mrs_natural/inSamples")->to<mrs_natural>() + 1;
Accumulator* acc = new Accumulator("acc");
acc->updControl("mrs_natural/nTimes", hops);
acc->addMarSystem(series);
realvec in(acc->getctrl("mrs_natural/inObservations")->to<mrs_natural>(),
acc->getctrl("mrs_natural/inSamples")->to<mrs_natural>());
realvec out(acc->getctrl("mrs_natural/onObservations")->to<mrs_natural>(),
acc->getctrl("mrs_natural/onSamples")->to<mrs_natural>());
acc->process(in,out);
out.send(communicator_);
// Util util;
// fname_ = fname;
// src_ = util.sfopen(fname, MRS_SF_READ);
// if (src_ == NULL)
// cout << "src_ = NULL" << endl;
// if (src_ != NULL) // File exists
// {
// src_->initWindow(lineSize, lineSize, 0, 0);
// PlotExtractor pextractor(src_, src_->winSize());
// fvec res(src_->iterations());
// pextractor.extract(0, src_->iterations(), res);
// res.send(communicator_);
// }
// else
// {
// fvec res(0);
// res.send(communicator_);
// }
}
示例6: GetTableRowFromDataSet
void
LocalService::CheckDataSet(
DcmDataset *dataSet,
SerieInfo &sInfo,
TableRow &row,
std::string path)
{
// load data from dataSet
GetTableRowFromDataSet( dataSet, &row);
GetSeriesInfo( dataSet, &sInfo);
// now check what is in database
Patients::iterator patIt = m_patients.find( row.patientID);
if( patIt == m_patients.end() )
{
// insert new patient
// insert new study
Serie serie(sInfo.id, sInfo.description, path);
Series s;
s.insert( Series::value_type( serie.id, serie) );
Study stud(row.studyID, row.date, s);
Studies buddStudies;
buddStudies.insert( Studies::value_type( stud.id, stud));
Patient buddPat( row.patientID, row.name, row.birthDate, row.sex, buddStudies);
m_patients.insert( Patients::value_type( row.patientID, buddPat) );
}
else
{
// perform lookup level down
Studies &studies = patIt->second.studies;
Studies::iterator studItr = studies.find( row.studyID);
if( studItr == studies.end() )
{
// insert new study
Serie serie(sInfo.id, sInfo.description, path);
Series s;
s.insert( Series::value_type( serie.id, serie) );
Study stud(row.studyID, row.date, s);
patIt->second.studies.insert( Studies::value_type(
stud.id, stud) );
}
else
{
// perform lookup level down
Series &series = studItr->second.series;
Series::iterator serItr = series.find( sInfo.id);
if( serItr == series.end() )
{
// insert new serie
Serie buddy(sInfo.id, sInfo.description, path);
series.insert( Series::value_type( sInfo.id, buddy) );
}
// else do nothing
}
}
}
示例7: _loadedFieldDictionary
DataDictionaryImpl::DataDictionaryImpl(const DataDictionaryImpl& other) :
_loadedFieldDictionary(false),
_loadedEnumTypeDef(false),
_pDictionaryEntryList(0),
_pEnumTypeTableList(0),
_ownRsslDataDictionary(true),
_pfieldNameToIdHash(0)
{
_errorText.length = MAX_ERROR_TEXT_SIZE;
_errorText.data = (char*)malloc(sizeof(char) * _errorText.length);
if ( !_errorText.data )
{
throwMeeException("Failed to allocate memory in DataDictionaryImpl::DataDictionaryImpl()");
}
if ( _ownRsslDataDictionary )
{
try
{
_pRsslDataDictionary = new RsslDataDictionary();
}
catch (std::bad_alloc)
{
throwMeeException("Failed to allocate memory in DataDictionaryImpl::DataDictionaryImpl()");
}
rsslClearDataDictionary(_pRsslDataDictionary);
}
if (!other._loadedEnumTypeDef && !other._loadedFieldDictionary)
{
return;
}
Series series;
if ( other._loadedFieldDictionary )
{
const_cast<DataDictionaryImpl&>(other).encodeFieldDictionary(series, DICTIONARY_VERBOSE);
StaticDecoder::setData(&series, 0);
decodeFieldDictionary(series, DICTIONARY_VERBOSE);
series.clear();
}
if ( other._loadedEnumTypeDef )
{
const_cast<DataDictionaryImpl&>(other).encodeEnumTypeDictionary(series, DICTIONARY_VERBOSE);
StaticDecoder::setData(&series, 0);
decodeEnumTypeDictionary(series, DICTIONARY_VERBOSE);
}
}
示例8: SetOffset
void LineChartPane::SetOffset(ViewChannels &channels, int offset){
for (size_t i = 0; i < channels.Count(); i++){
ViewChannel &channel = channels[i];
Series *series = m_lineChart->GetSeries(channel.ToString());
if (NULL != series){
series->SetOffset(offset);
}
}
m_lineChart->Refresh();
}
示例9: perform_test_trivial
void perform_test_trivial() {
Series s;
typedef ParserResultElement<Series> Parser;
Parser p(s);
{
const std::string test = "09/y-i/A/xXyY1";
OKLIB_TESTTRIVIAL_RETHROW(::OKlib::Parser::Test_ParsingString<Parser>(p, test, ::OKlib::Parser::match_full));
if(s.name() != test)
OKLIB_THROW("Resulting name is " + s.name() + ", and not " + test);
}
}
示例10: coarse_grain
coarse_grain(Series const &series, Discretization discretization, ordered_inserter<Out> out)
{
typedef typename concepts::TimeSeries<Series const>::offset_type offset_type;
BOOST_ASSERT(discretization > series.discretization());
BOOST_ASSERT(discretization % series.discretization() == 0);
offset_type factor = discretization / series.discretization();
detail::coarse_grain_inserter<ordered_inserter<Out>, offset_type> o(out, factor);
return range_run_storage::copy(series, o).out();
}
示例11: UpdateValueRange
void LineChartPane::UpdateValueRange(ViewDataHistoryArray &historyArray, size_t fromIndex, size_t toIndex){
for (size_t i = 0; i < historyArray.size(); i++){
ViewDataHistory &history = historyArray[i];
Series *series = m_lineChart->GetSeries(history.channel.ToString());
if (NULL != series){
for (size_t i = fromIndex; i < toIndex; i++){
series->SetValueAt(i, history.values[i]);
}
m_lineChart->Refresh();
}
}
}
示例12: tprintf
// Parses an Output spec.
Network* NetworkBuilder::ParseOutput(const StaticShape& input_shape,
char** str) {
char dims_ch = (*str)[1];
if (dims_ch != '0' && dims_ch != '1' && dims_ch != '2') {
tprintf("Invalid dims (2|1|0) in output spec!:%s\n", *str);
return nullptr;
}
char type_ch = (*str)[2];
if (type_ch != 'l' && type_ch != 's' && type_ch != 'c') {
tprintf("Invalid output type (l|s|c) in output spec!:%s\n", *str);
return nullptr;
}
int depth = strtol(*str + 3, str, 10);
if (depth != num_softmax_outputs_) {
tprintf("Warning: given outputs %d not equal to unicharset of %d.\n", depth,
num_softmax_outputs_);
depth = num_softmax_outputs_;
}
NetworkType type = NT_SOFTMAX;
if (type_ch == 'l')
type = NT_LOGISTIC;
else if (type_ch == 's')
type = NT_SOFTMAX_NO_CTC;
if (dims_ch == '0') {
// Same as standard fully connected.
return BuildFullyConnected(input_shape, type, "Output", depth);
} else if (dims_ch == '2') {
// We don't care if x and/or y are variable.
return new FullyConnected("Output2d", input_shape.depth(), depth, type);
}
// For 1-d y has to be fixed, and if not 1, moved to depth.
if (input_shape.height() == 0) {
tprintf("Fully connected requires fixed height!\n");
return nullptr;
}
int input_size = input_shape.height();
int input_depth = input_size * input_shape.depth();
Network* fc = new FullyConnected("Output", input_depth, depth, type);
if (input_size > 1) {
Series* series = new Series("FCSeries");
series->AddToStack(new Reconfig("FCReconfig", input_shape.depth(), 1,
input_shape.height()));
series->AddToStack(fc);
fc = series;
}
return fc;
}
示例13: GetSeries
void
LocalService::FindStudyInfo(
SerieInfoVector &result,
const std::string &patientID,
const std::string &studyID)
{
// just take informatoin from tree
Series series = GetSeries( patientID, studyID);
SerieInfo s;
for( Series::iterator serie=series.begin();
serie != series.end(); serie++)
{
s.id = serie->second.id;
s.description = serie->second.desc;
result.push_back( s);
}
}
示例14: Series2D
bool TestSeries2DwithData::DoTest()
{
Series *serie;
serie = new Series2D("new series");
DataNoType *xdata, *ydata;
xdata = new DataTyped<double>(100, "x-data");
ydata = new DataTyped<double>(100, "y-data");
serie->SetData(xdata, AXIS_X);
serie->SetData(ydata, AXIS_Y);
//delete ydata;
delete xdata;
delete serie;
return true;
}
示例15: main
int main()
{
//threaded
try
{
Series test ("/title/tt0436992/");
test.getEpisodes();
std::cout << test.getXML();
}
catch (const char* msg)
{
std::cerr << msg << std::endl;
}
}