本文整理汇总了C++中model_type类的典型用法代码示例。如果您正苦于以下问题:C++ model_type类的具体用法?C++ model_type怎么用?C++ model_type使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了model_type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
static void process( model_type &result )
{
for( index_type index = 0; index < container_trait_type::size(); index ++ )
{
if( result.get( index ) < bound_type::minimum( index ) )
{
result.set( index, bound_type::minimum( index ) );
continue;
}
if( bound_type::maximum( index ) < result.get( index ) )
{
result.set( index, bound_type::maximum( index ) );
continue;
}
}
}
示例2: operator
void operator()(model_type& model, abstract_window_type& parent)
const
{
if (!m_confirm_file_save(parent))
return;
model.reset_timetable(tetengo2::stdalt::make_unique<timetable_type>());
}
示例3: process
static index_type process( model_type const& m )
{
for( index_type index = 0; index < container_trait_type::size(); index ++ )
{
if( m.get( index ) < bound_type::minimum( index ) )
{
return index;
continue;
}
if( bound_type::maximum( index ) < m.get( index ) )
{
return index;
continue;
}
}
return container_trait_type::size();
}
示例4: hessian
void
L2<Model, Hessian>::hessian(
const model_type &model,
const double &lambda,
hessian_type &hessian)
{
int n = model.rows();
hessian += lambda * hessian.Identity(n, n);
hessian(n-1, n-1) -= lambda;
}
示例5: gradient
void
L2<Model, Hessian>::gradient(
const model_type &model,
const double &lambda,
model_type &gradient)
{
Index i;
for (i = 0; i < model.rows()-1; i++)
gradient(i) += lambda * model(i);
}
示例6: model
double
L2<Model, Hessian>::loss(
const model_type &model,
const double &lambda)
{
Index i;
double s = 0.;
for (i = 0; i < model.rows()-1; i++)
s += model(i) * model(i);
return lambda * s / 2.;
}
示例7: execute
void execute(model_type& model, abstract_window_type& parent)
const
{
file_property_dialog_type dialog{ parent, m_message_catalog };
dialog.set_company_name(model.timetable().company_name());
dialog.set_line_name(model.timetable().line_name());
dialog.set_note(model.timetable().note());
if (model.has_path())
dialog.set_file_name(model.path().template string<string_type>());
dialog.do_modal();
if (dialog.result() != dialog_type::result_type::accepted)
return;
model.timetable().set_company_name(dialog.company_name());
model.timetable().set_line_name(dialog.line_name());
model.timetable().set_note(dialog.note());
}
示例8: decode
unsigned int decode(model_type const & model)
{
uint32_t const Count = GetCurrentCount(model.getTotal());
unsigned int Symbol;
for(Symbol=model.getSigma()-1;model.getLow(Symbol)>Count;Symbol--)
{
}
RemoveRange(model.getLow(Symbol),model.getHigh(Symbol),model.getTotal());
return Symbol;
}
示例9: operator
void operator()(
model_type& model,
const tetengo2::stdalt::optional<tetengo2::stdalt::filesystem::path>& given_path,
abstract_window_type& parent) const
{
if (!m_ask_file_path && !model.has_path() && !given_path)
return;
if (!m_confirm_file_save(parent))
return;
tetengo2::stdalt::filesystem::path path{};
if (given_path)
{
path = *given_path;
}
else if (m_ask_file_path)
{
file_open_dialog_type dialog{ m_message_catalog.get(TETENGO2_TEXT("Dialog:FileOpenSave:Open")),
make_file_filters(),
parent };
const auto ok = dialog.do_modal();
if (!ok)
return;
path = dialog.result();
}
else
{
assert(model.has_path());
path = model.path();
}
std::ifstream input_stream{ path, std::ios_base::binary };
if (!input_stream)
{
create_cant_open_file_message_box(path, parent)->do_modal();
return;
}
reader_selector_type reader_selector{ reader_set_type::create_readers(
parent, path.template string<typename string_type::value_type>(), m_message_catalog) };
const auto first = tetengo2::iterator::make_observable_forward_iterator(
boost::spirit::make_default_multi_pass(std::istreambuf_iterator<char>{ input_stream }));
const auto last = tetengo2::iterator::make_observable_forward_iterator(
boost::spirit::make_default_multi_pass(std::istreambuf_iterator<char>{}));
auto error = reader_error_type::none;
auto p_timetable = reader_selector.read(first, last, error);
if (!p_timetable)
{
switch (error)
{
case reader_error_type::canceled:
break; // Do nothing.
case reader_error_type::corrupted:
create_file_broken_message_box(path, parent)->do_modal();
break;
case reader_error_type::unsupported:
create_unsupported_format_file_message_box(path, parent)->do_modal();
break;
default:
assert(false);
BOOST_THROW_EXCEPTION(std::logic_error("Unknown reader error."));
}
return;
}
model.reset_timetable(std::move(p_timetable), path);
}
示例10: reloadable
bool reloadable(
const model_type& model,
const tetengo2::stdalt::optional<tetengo2::stdalt::filesystem::path>& given_path) const
{
return m_ask_file_path || model.has_path() || given_path;
}
示例11: process
inline static void process( container_output_type & container )
{
static model_type s_model{ rgb_type{ 0.69, 0.19, 0.38 } };
container = s_model.container();
}
示例12: process
inline static void process( container_output_type & container )
{
static model_type s_model{ rgb_type{ 1, 0, 1 } };
container = s_model.container();
}
示例13: decodeUpdate
unsigned int decodeUpdate(model_type & model)
{
unsigned int const Symbol = decode(model);
model.update(Symbol);
return Symbol;
}
示例14: process
inline static void process( container_output_type & container )
{
static model_type s_model{ rgb_type{ 0xFF, 0xC0, 0xCB } };
container = s_model.container();
}
示例15: process
inline static void process( container_output_type & container )
{
static model_type s_model{ rgb_type{ 0.5, 1, 212.0/255.0 } };
container = s_model.container();
}