本文整理汇总了C++中ef函数的典型用法代码示例。如果您正苦于以下问题:C++ ef函数的具体用法?C++ ef怎么用?C++ ef使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ef函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ode_evaluate
void ode_evaluate(
CppAD::vector<Float> &x ,
size_t m ,
CppAD::vector<Float> &fm )
{
typedef CppAD::vector<Float> Vector;
size_t n = x.size();
size_t ell;
CPPAD_ASSERT_KNOWN( m == 0 || m == 1,
"ode_evaluate: m is not zero or one"
);
CPPAD_ASSERT_KNOWN(
((m==0) & (fm.size()==n)) || ((m==1) & (fm.size()==n*n)),
"ode_evaluate: the size of fm is not correct"
);
if( m == 0 )
ell = n;
else ell = n + n * n;
// set up the case we are integrating
Float ti = 0.;
Float tf = 1.;
Float smin = 1e-5;
Float smax = 1.;
Float scur = 1.;
Float erel = 0.;
vector<Float> yi(ell), eabs(ell);
size_t i, j;
for(i = 0; i < ell; i++)
{ eabs[i] = 1e-10;
if( i < n )
yi[i] = 1.;
else yi[i] = 0.;
}
// return values
Vector yf(ell), ef(ell), maxabs(ell);
size_t nstep;
// construct ode method for taking one step
ode_evaluate_method<Float> method(m, x);
// solve differential equation
yf = OdeErrControl(method,
ti, tf, yi, smin, smax, scur, eabs, erel, ef, maxabs, nstep);
if( m == 0 )
{ for(i = 0; i < n; i++)
fm[i] = yf[i];
}
else
{ for(i = 0; i < n; i++)
for(j = 0; j < n; j++)
fm[i * n + j] = yf[n + i * n + j];
}
return;
}
示例2: exi_dir1
static void exi_dir1 (RAnalOp *op, ut8 addr, const char *operation) {
if (addr < 0x80) {
ef ("_idata,%d,+,%s=[1],", addr, operation);
} else {
ef ("_sfr,0x7f,%d,&,+,%s=[1],", addr, operation);
}
}
示例3: exw_dir2
static void exw_dir2(RAnalOp *op, ut8 addr) {
if (addr < 0x80) {
ef ("_idata,%d,+,=[1],", addr);
} else {
ef ("_sfr,0x7f,%d,&,+,=[1],", addr);
}
}
示例4: strlen
ostream &
ostream::operator<<(const char *str)
{
// TODO: At the moment we don't have a good way of specifying the
// VCPU that a print function comes from. We need to extend iostream
// so that a print statement can state which VCPU it's coming from
// so that it can be directed to the proper vcpu here. At the moment
// everything is broadcast (i.e. all vcpus will get the same output)
int len = strlen(str);
int gap = m_width - len;
if (m_width > 0)
m_width = 0;
if (m_justify == std::right)
{
for (auto i = 0; i < gap; i++)
ef()->write(" ", 1);
}
ef()->write(str, len);
if (m_justify == std::left)
{
for (auto i = 0; i < gap; i++)
ef()->write(" ", 1);
}
return *this;
}
示例5: Seek
void Cf3Replay::Save(Cf3StageFile *stage, int map)
{
if (CApp::MakeFileName(m_FileName,"f3r",theSetting->m_RecordNumber,true)) {
Cf3StageFile data;
DWORD chunk, size;
BYTE* ptr;
// キー入力情報をこーんぽたーじゅ(謎)
ptr = new BYTE[m_nSize*2];
Seek();
while(!Finished()) {
ptr[m_nProgress*2 ] = (*m_iPointer).pressed [m_nPointer];
ptr[m_nProgress*2+1 ] = (*m_iPointer).pushed [m_nPointer];
Progress();
}
data.SetStageData(CT_RPLY, m_nSize*2, ptr);
delete[]ptr;
// 必要なステージ情報をコピーする
if (ptr=stage->GetStageData(chunk=CT_TITL,&size))
data.SetStageData(chunk,size,ptr);
if (ptr=stage->GetStageData(chunk=CT_HITS,&size))
data.SetStageData(chunk,size,ptr);
if (ptr=stage->GetStageData(chunk=Cf3Map::GetChunkType(CT_TL00,map),&size))
data.SetStageData(chunk,size,ptr);
if (ptr=stage->GetStageData(chunk=Cf3Map::GetChunkType(CT_M000,map),&size))
data.SetStageData(chunk,size,ptr);
if (ptr=stage->GetStageData(chunk=Cf3Map::GetChunkType(CT_M100,map),&size))
data.SetStageData(chunk,size,ptr);
if (ptr=stage->GetStageData(chunk=Cf3Map::GetChunkType(CT_M200,map),&size))
data.SetStageData(chunk,size,ptr);
if (ptr=stage->GetStageData(chunk=CT_MCD0|(0<<24),&size))
data.SetStageData(chunk,size,ptr);
ef (ptr=stage->GetStageData(chunk=CT_MCF0|(0<<24),&size))
data.SetStageData(chunk,size,ptr);
if (ptr=stage->GetStageData(chunk=CT_MCD0|(1<<24),&size))
data.SetStageData(chunk,size,ptr);
ef (ptr=stage->GetStageData(chunk=CT_MCF0|(1<<24),&size))
data.SetStageData(chunk,size,ptr);
if (ptr=stage->GetStageData(chunk=CT_MCD0|(2<<24),&size))
data.SetStageData(chunk,size,ptr);
ef (ptr=stage->GetStageData(chunk=CT_MCF0|(2<<24),&size))
data.SetStageData(chunk,size,ptr);
// 追加の情報
data.SetStageData(CT_STGN, 4, &map);
data.SetStageData(CT_GRVT, 4, &theSetting->m_Gravity);
data.SetStageData(CT_HYPR, 4, &theSetting->m_Hyper);
data.Write(m_FileName);
}
}
示例6: ef_enumeration_benchmark
void ef_enumeration_benchmark(uint64_t m, uint8_t bits)
{
succinct::elias_fano::elias_fano_builder bvb(uint64_t(1) << bits, m);
monotone_generator mgen(m, bits, 37);
for (size_t i = 0; i < m; ++i) {
bvb.push_back(mgen.next());
}
assert(mgen.done());
succinct::elias_fano ef(&bvb);
succinct::mapper::size_tree_of(ef)->dump();
double elapsed;
uint64_t foo = 0;
SUCCINCT_TIMEIT(elapsed) {
succinct::elias_fano::select_enumerator it(ef, 0);
for (size_t i = 0; i < m; ++i) {
foo ^= it.next();
}
}
volatile uint64_t vfoo = foo;
(void)vfoo; // silence warning
std::cerr << "Elapsed: " << elapsed / 1000 << " msec\n"
<< double(m) / elapsed << " Mcodes/s" << std::endl;
}
示例7: xdl_diff_modified
int xdl_diff_modified(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
xdemitconf_t const *xecfg, xdemitcb_t *ecb, xdfenv_t *pxe, xdchange_t **pxscr) {
emit_func_t ef = xecfg->hunk_func ? xdl_call_hunk_func : xdl_emit_diff;
if (xdl_do_diff(mf1, mf2, xpp, pxe) < 0) {
return -1;
}
if (xdl_change_compact(&pxe->xdf1, &pxe->xdf2, xpp->flags) < 0 ||
xdl_change_compact(&pxe->xdf2, &pxe->xdf1, xpp->flags) < 0 ||
xdl_build_script(pxe, pxscr) < 0) {
xdl_free_env(pxe);
return -1;
}
if (*pxscr) {
if (xpp->flags & XDF_IGNORE_BLANK_LINES)
xdl_mark_ignorable(*pxscr, pxe, xpp->flags);
if (ef(pxe, *pxscr, ecb, xecfg) < 0) {
xdl_free_script(pxscr);
xdl_free_env(pxe);
return -1;
}
}
return 0;
}
示例8: e
void EFXFixture_Test::loadSuccess()
{
QDomDocument doc;
QDomElement root = doc.createElement("Fixture");
QDomElement id = doc.createElement("ID");
QDomText idText = doc.createTextNode("83");
id.appendChild(idText);
root.appendChild(id);
QDomElement head = doc.createElement("Head");
QDomText headText = doc.createTextNode("76");
head.appendChild(headText);
root.appendChild(head);
QDomElement dir = doc.createElement("Direction");
QDomText dirText = doc.createTextNode("Backward");
dir.appendChild(dirText);
root.appendChild(dir);
QDomElement in = doc.createElement("Intensity");
QDomText inText = doc.createTextNode("91");
in.appendChild(inText);
root.appendChild(in);
EFX e(m_doc);
EFXFixture ef(&e);
QVERIFY(ef.loadXML(root) == true);
QVERIFY(ef.head().fxi == 83);
QVERIFY(ef.head().head == 76);
QVERIFY(ef.direction() == EFX::Backward);
QVERIFY(ef.fadeIntensity() == 91);
}
示例9: e
void EFXFixture_Test::initial()
{
EFX e(m_doc);
EFXFixture ef(&e);
QVERIFY(ef.fixture() == Fixture::invalidId());
QVERIFY(ef.direction() == EFX::Forward);
QVERIFY(ef.serialNumber() == 0);
QVERIFY(ef.startScene() == NULL);
QVERIFY(ef.stopScene() == NULL);
QVERIFY(ef.isValid() == false);
QVERIFY(ef.isReady() == false);
QVERIFY(ef.m_fixture == Fixture::invalidId());
QVERIFY(ef.m_direction == EFX::Forward);
QVERIFY(ef.m_serialNumber == 0);
QVERIFY(ef.m_runTimeDirection == EFX::Forward);
QVERIFY(ef.m_startScene == NULL);
QVERIFY(ef.m_stopScene == NULL);
QVERIFY(ef.m_initialized == false);
QVERIFY(ef.m_ready == false);
QVERIFY(ef.m_iterator == 0);
QVERIFY(ef.m_skipIterator == 0);
QVERIFY(ef.m_skipThreshold == 0);
QVERIFY(ef.m_panValue == 0);
QVERIFY(ef.m_tiltValue == 0);
QVERIFY(ef.m_lsbPanChannel == Fixture::invalidChannel());
QVERIFY(ef.m_msbPanChannel == Fixture::invalidChannel());
QVERIFY(ef.m_lsbTiltChannel == Fixture::invalidChannel());
QVERIFY(ef.m_msbTiltChannel == Fixture::invalidChannel());
}
示例10: QLatin1Char
/*!
Constructs a QMimeType from a \a fileName.
*/
QMimeType QMimeType::fromFileName( const QString &fileName )
{
QMimeType type;
int slashIndex = fileName.lastIndexOf( QLatin1Char( '/' ) );
int dotIndex = fileName.lastIndexOf( QLatin1Char( '.' ) );
if( dotIndex > slashIndex )
{
if(loadedTimes()->count() == 0)
loadExtensions();
QString extension = fileName.mid( dotIndex + 1 ).toLower();
type.mimeId = typeFor()->value( extension );
}
if( type.mimeId.isEmpty() )
{
const char elfMagic[] = { '\177', 'E', 'L', 'F', '\0' };
QFile ef( fileName );
if ( ef.size() > 5 && ef.open( QIODevice::ReadOnly ) && ef.peek(5) == elfMagic) // try to find from magic
type.mimeId = QLatin1String("application/x-executable"); // could be a shared library or an exe
else
type.mimeId = QLatin1String("application/octet-stream");
}
return type;
}
示例11: xdl_diff
int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
xdemitconf_t const *xecfg, xdemitcb_t *ecb) {
xdchange_t *xscr;
xdfenv_t xe;
emit_func_t ef = xecfg->hunk_func ? xdl_call_hunk_func : xdl_emit_diff;
if (xdl_do_diff(mf1, mf2, xpp, &xe) < 0) {
return -1;
}
if (xdl_change_compact(&xe.xdf1, &xe.xdf2, xpp->flags) < 0 ||
xdl_change_compact(&xe.xdf2, &xe.xdf1, xpp->flags) < 0 ||
xdl_build_script(&xe, &xscr) < 0) {
xdl_free_env(&xe);
return -1;
}
if (xscr) {
if (ef(&xe, xscr, ecb, xecfg) < 0) {
xdl_free_script(xscr);
xdl_free_env(&xe);
return -1;
}
xdl_free_script(xscr);
}
xdl_free_env(&xe);
return 0;
}
示例12: ef
// Handler for deliverEventQueue.
// This thread decodes frames from events.
void Cluster::deliveredEvent(const Event& e) {
if (e.isCluster()) {
EventFrame ef(e, e.getFrame());
// Stop the deliverEventQueue on update offers.
// This preserves the connection decoder fragments for an update.
// Only do this for the two brokers that are directly involved in this
// offer: the one making the offer, or the one receiving it.
const ClusterUpdateOfferBody* offer = castUpdateOffer(ef.frame.getBody());
if (offer && ( e.getMemberId() == self || MemberId(offer->getUpdatee()) == self) ) {
QPID_LOG(info, *this << " stall for update offer from " << e.getMemberId()
<< " to " << MemberId(offer->getUpdatee()));
deliverEventQueue.stop();
}
deliverFrame(ef);
}
else if(!discarding) {
if (e.isControl())
deliverFrame(EventFrame(e, e.getFrame()));
else {
try { decoder.decode(e, e.getData()); }
catch (const Exception& ex) {
// Close a connection that is sending us invalid data.
QPID_LOG(error, *this << " aborting connection "
<< e.getConnectionId() << ": " << ex.what());
framing::AMQFrame abort((ClusterConnectionAbortBody()));
deliverFrame(EventFrame(EventHeader(CONTROL, e.getConnectionId()), abort));
}
}
}
}
示例13: e
void EFXFixture_Test::isValid()
{
EFX e(m_doc);
EFXFixture ef(&e);
QVERIFY(ef.isValid() == false);
ef.setFixture(0);
QVERIFY(ef.isValid() == true);
}
示例14: HitTestPopup
bool HwndSourceHookMenuPopup::HandleMouseMove(suic::MessageParameter& mp)
{
bool handled = false;
MenuPtr hotMenu = HitTestPopup();
if (IsMouseCapture())
{
handled = true;
if (!hotMenu)
{
if (_focusMenu)
{
suic::MouseEventArg ef(NULL, mp.point);
_focusMenu->OnMouseLeave(ef);
}
_focusMenu = hotMenu;
}
else
{
suic::MouseEventArg e(hotMenu.get(), suic::SystemHelper::GetCursorPoint(hotMenu.get()));
if (_focusMenu && _focusMenu != hotMenu)
{
suic::MouseEventArg ef(hotMenu.get(), mp.point);
_focusMenu->OnMouseLeave(ef);
}
hotMenu->OnMouseMove(e);
_focusMenu = hotMenu;
}
}
else if (!hotMenu)
{
handled = true;
suic::HwndHelper::HandleDefWndMessage(mp);
}
return handled;
}
示例15: main
int main()
{
EField ef(1000);
ef.addPointCharge(5,5,-1.0);
ef.printPointCharges();
ef.printEField();
return 0;
}