inline void Hanowa( DistMatrix<T,U,V>& A, int n, T mu ) { #ifndef RELEASE CallStackEntry entry("Hanowa"); #endif if( n % 2 != 0 ) throw std::logic_error("n must be an even integer"); A.ResizeTo( n, n ); const int m = n/2; std::vector<T> d(m); DistMatrix<T,U,V> ABlock( A.Grid() ); for( int j=0; j<m; ++j ) d[j] = mu; View( ABlock, A, 0, 0, m, m ); Diagonal( ABlock, d ); View( ABlock, A, m, m, m, m ); Diagonal( ABlock, d ); for( int j=0; j<m; ++j ) d[j] = -(j+1); View( ABlock, A, 0, m, m, m ); Diagonal( ABlock, d ); for( int j=0; j<m; ++j ) d[j] = j+1; View( ABlock, A, m, 0, m, m ); Diagonal( ABlock, d ); }
int main(int argc, char *argv[]) { Stack *top = new Stack; //зазаносим данные в стек int a = 123; Push(top, a); a = 456; Push(top, a); a = 789; Push(top, a); //смотрим текущее состояние cout << "stack: " << endl; View(top); //Достаем данные cout << endl << Pop(*top); cout << endl << Pop(*top) << endl; //смотрим текущее состояние cout << endl << "stack: " << endl; View(top); system("pause"); return 0; }
// StartDraggingSplitter bool BSplitLayout::StartDraggingSplitter(BPoint point) { StopDraggingSplitter(); // Layout must be valid. Bail out, if it isn't. if (!fLayoutValid) return false; // Things shouldn't be draggable, if we have a >= max layout. BSize size = _SubtractInsets(View()->Frame().Size()); if ((fOrientation == B_HORIZONTAL && size.width >= fMax.width) || (fOrientation == B_VERTICAL && size.height >= fMax.height)) { return false; } int32 index = -1; if (_SplitterItemAt(point, &index) != NULL) { fDraggingStartPoint = View()->ConvertToScreen(point); fDraggingStartValue = _SplitterValue(index); fDraggingCurrentValue = fDraggingStartValue; fDraggingSplitterIndex = index; return true; } return false; }
void cxFollow::OnStep(cxFloat dt) { if(cxFloatIsEqual(speed, 0)){ Exit(true); return; } cxView *target = GetTarget(); //target miss if(target == nullptr){ onMiss.Fire(this); Exit(true); return; } cxPoint2F cpos = View()->Position(); cxPoint2F tpos = target->Position() + offset; cxFloat angle = cpos.Angle(tpos); if(!cxFloatIsOK(angle)){ return; } cxFloat dv = dt * speed; cpos.x += cosf(angle) * dv; cpos.y += sinf(angle) * dv; View()->SetPosition(cpos); //if position changed if(View()->IsDirtyMode(cxView::DirtyModePosition)){ onMoving.Fire(this); } cxAction::OnStep(dt); }
void ALMGroup::_Build(BALMLayout* layout, BReference<XTab> left, BReference<YTab> top, BReference<XTab> right, BReference<YTab> bottom) const { if (LayoutItem()) layout->AddItem(LayoutItem(), left, top, right, bottom); else if (View()) { layout->AddView(View(), left, top, right, bottom); } else { for (unsigned int i = 0; i < Groups().size(); i++) { const ALMGroup& current = Groups()[i]; if (Orientation() == B_HORIZONTAL) { BReference<XTab> currentRight; if (i == Groups().size() - 1) currentRight = right; else currentRight = layout->AddXTab(); current._Build(layout, left, top, currentRight, bottom); left = currentRight; } else { BReference<YTab> currentBottom; if (i == Groups().size() - 1) currentBottom = bottom; else currentBottom = layout->AddYTab(); current._Build(layout, left, top, right, currentBottom); top = currentBottom; } } } }
void PartitionDown ( Matrix<T>& A, Matrix<T>& AT, Matrix<T>& AB, Int heightAT ) { DEBUG_ONLY(CSE cse("PartitionDown")) heightAT = Max(Min(heightAT,A.Height()),0); const Int heightAB = A.Height()-heightAT; View( AT, A, 0, 0, heightAT, A.Width() ); View( AB, A, heightAT, 0, heightAB, A.Width() ); }
void World::mouseReleased(int x, int y, int button){ if(View() == CAPTURE_POSTURE_VIEW){ _player->savePosture("postures-captured.xml"); //space saves posture _player->getUserMapRef()->getKinectControllerRef()->saveImageForCaptures(); } else if(View() == INSTRUCTIONS_VIEW){ _instructions.nextSlide(); } else if(View() == FIRST_PERSON_VIEW || View() == END_GAME_VIEW){ ofSaveScreen("captures/captures_"+ofGetTimestampString()+".png"); } }
inline void Lauchli( BlockDistMatrix<T,U,V>& A, Int n, T mu ) { DEBUG_ONLY(CallStackEntry cse("Lauchli")) A.Resize( n+1, n ); auto ABlock = View( A, 0, 0, 1, n ); MakeOnes( ABlock ); std::vector<T> d(n,mu); ABlock = View( A, 1, 0, n, n ); Diagonal( ABlock, d ); }
void Fluid::Project( int maxIterations, const View2f& velocities, View2f* velocitiesProjected) const { // Part1: Compute divergence of velocity field. auto divergence = Image<float, 1>::Create(_velocities->Rect(), _velocities->Width(), 1, 1); auto pressure = Image<float, 1>::Create(divergence->View(), kLeaveUninitialized); Divergence(_velocities->View(), &divergence->View()); ComputePressureField(maxIterations, divergence->View(), &pressure->View()); divergence.reset(); // Part2: Make the velocity field divergence-free by substracting pressure gradients. SubstractGradient(_velocities->View(), pressure->View(), velocitiesProjected); }
void BTwoDimensionalLayout::LayoutView() { _ValidateMinMax(); // layout the horizontal/vertical elements BSize size = SubtractInsets(View()->Frame().Size()); #ifdef DEBUG_LAYOUT printf("BTwoDimensionalLayout::LayoutView(%p): size: (%.1f, %.1f)\n", View(), size.width, size.height); #endif fLocalLayouter->Layout(size); // layout the items int itemCount = CountItems(); for (int i = 0; i < itemCount; i++) { BLayoutItem* item = ItemAt(i); if (item->IsVisible()) { Dimensions itemDimensions; GetItemDimensions(item, &itemDimensions); BRect frame = fLocalLayouter->ItemFrame(itemDimensions); frame.left += fLeftInset; frame.top += fTopInset; frame.right += fLeftInset; frame.bottom += fTopInset; { #ifdef DEBUG_LAYOUT printf(" frame for item %2d (view: %p): ", i, item->View()); frame.PrintToStream(); #endif //BSize min(item->MinSize()); //BSize max(item->MaxSize()); //printf(" min: (%.1f, %.1f), max: (%.1f, %.1f)\n", min.width, min.height, // max.width, max.height); //if (item->HasHeightForWidth()) { //float minHeight, maxHeight, preferredHeight; //item->GetHeightForWidth(frame.Width(), &minHeight, &maxHeight, // &preferredHeight); //printf(" hfw: min: %.1f, max: %.1f, pref: %.1f\n", minHeight, maxHeight, // preferredHeight); //} } item->AlignInFrame(frame); } //else //printf(" item %2d not visible", i); } }
// __________________________________________________________________________________________________ // RegistersDlgProc // BOOL CALLBACK CDynaViewDlg::DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_PREVBLOCK: { if (m_iBlock>0) View(m_iBlock-1); } break; case IDC_NEXTBLOCK: { if (m_iBlock>=-1) View(m_iBlock+1); } break; case IDC_CODEADDRESS: { } break; } } break; case WM_INITDIALOG: { SendMessage(GetDlgItem(hDlg,IDC_X86ASM),WM_SETFONT,(WPARAM)dfont,0); SendMessage(GetDlgItem(hDlg,IDC_POWERPCASM),WM_SETFONT,(WPARAM)dfont,0); View(-1); return TRUE; } break; case WM_SIZE: Size(); break; case WM_CLOSE: Show(false); break; } return FALSE; }
int MkView::HashCmd() { c4_View nview = View(interp, objv[2]); int nkeys = objc > 3 ? tcl_GetIntFromObj(objv[3]): 1; MkView *ncmd = new MkView(interp, view.Hash(nview, nkeys)); return tcl_SetObjResult(tcl_NewStringObj(ncmd->CmdName())); }
// _LayoutItem void BSplitLayout::_LayoutItem(BLayoutItem* item, BRect frame, bool visible) { // update the layout frame ItemLayoutInfo* info = _ItemLayoutInfo(item); info->isVisible = visible; if (visible) info->layoutFrame = frame; else info->layoutFrame = BRect(0, 0, -1, -1); // update min/max info->min = item->MinSize(); info->max = item->MaxSize(); if (item->HasHeightForWidth()) { BSize size = _SubtractInsets(View()->Frame().Size()); float minHeight, maxHeight; item->GetHeightForWidth(size.width, &minHeight, &maxHeight, NULL); info->min.height = max_c(info->min.height, minHeight); info->max.height = min_c(info->max.height, maxHeight); } // layout the item if (visible) item->AlignInFrame(frame); }
/// /// Assign to this view_or_value from a moved-in view_or_value. /// /// TODO CXX-800: Create a noexcept expression to check the conditions that must be met. BSONCXX_INLINE view_or_value& operator=(view_or_value&& other) noexcept { _value = std::move(other._value); _view = _value ? *_value : std::move(other._view); other._view = View(); other._value = stdx::nullopt; return *this; }
void Kinectic::onRender() { getRenderer()->setClearColor(Color::Blue); getRenderer()->setProjectionMatrix(View(0,0,1024,768).getMatrix()); world.drawDebugShapes(getRenderer()); }
int MkView::PairCmd() { c4_View nview = View(interp, objv[2]); MkView *ncmd = new MkView(interp, view.Pair(nview)); return tcl_SetObjResult(tcl_NewStringObj(ncmd->CmdName())); }
void cohen_test(Pixel *PixelBuffer) { Raster raster; Points bounds; bounds.push_back({ 10, 10 }); bounds.push_back({ 10, 100 }); bounds.push_back({ 100, 100 }); bounds.push_back({ 100, 10 }); Points shape; shape.push_back({ 5, 5 }); shape.push_back({ 50, 115 }); View view = View(SCREENSIZE, SCREENSIZE, PixelBuffer); Points *p = raster.cohen_sutherland(&bounds, &shape); if (p != NULL) { Points *r = Bresenham(p->at(0), p->at(1)); view.update_buffer(r); delete r; } else { std::cout << "NOPE< NULLLLLL\n"; } delete p; }
/// Return a description of the view structure (default is all) const char *c4_Storage::Description(const char *name_) { if (name_ == 0 || *name_ == 0) return c4_View::Description(); c4_View v = View(name_); return v.Description(); }
//----------------------------------------------------------------------- void Camera::_UpdateViewImpl(void) { const Vector3f Vaxis(0.0f, 1.0f, 0.0f); Vector3f View(1.0f, 0.0f, 0.0f); View.Rotate(m_angleHorizontal, Vaxis); View.Normalize(); Vector3f Haxis = View.Cross(Vaxis); Haxis.Normalize(); View.Rotate(m_angleVertical, Haxis); m_targetVector= View; m_targetVector.Normalize(); m_upVector = Haxis.Cross(m_targetVector); m_upVector.Normalize(); Vector3f pos = m_positionVector; if(mp_parentNode) { pos += mp_parentNode->_GetDerivedPosition(); } m_viewMatrix.InitCameraTransform(pos, m_targetVector, m_upVector); }
bool ClustFlat(const ClustOptions& opts, const std::vector<DenseMatrix<T> >& topic_vectors, const MatrixType<T>& A, T* buf_w, T* buf_h) { int m = opts.nmf_opts.height; int n = opts.nmf_opts.width; int k = opts.num_clusters; DenseMatrix<T> W(m, k, buf_w, m); // load matrix W with the topic vectors DenseMatrix<T> col_w; for (int c=0; c<k; ++c) { // create a view of the cth column of W View(col_w, W, 0, c, m, 1); // copy the next topic vector into place Copy(topic_vectors[c], col_w); } // randomly initialize matrix H Random rng; rng.SeedFromTime(); RandomMatrix(buf_h, k, k, n, rng, T(0.5), T(0.5)); DenseMatrix<T> H(k, n, buf_h, k); bool ok = NnlsHals(A, W, H, opts.nmf_opts.tol, opts.verbose, opts.nmf_opts.max_iter); return ok; }
inline void PartitionRight( DM& A, DM& AL, DM& AR, Int widthAL ) { #ifndef RELEASE PushCallStack("PartitionRight [DistMatrix]"); if( widthAL < 0 ) throw std::logic_error("Width of left partition must be non-negative"); #endif widthAL = std::min(widthAL,A.Width()); const Int widthAR = A.Width()-widthAL; View( AL, A, 0, 0, A.Height(), widthAL ); View( AR, A, 0, widthAL, A.Height(), widthAR ); #ifndef RELEASE PopCallStack(); #endif }
int nocturn::runNoctrun(int argc, char** argv) { app = new QApplication(argc, argv); app->setApplicationName("Nocturn"); QStringList args = app->arguments(); bool autoLoadMode = false; QStringList path; if (args.count() >= 3 and args.at(1) == "-f" and args.at(2) != "") { for (unsigned i = 2; i < argc; ++i) { path << args.at(i); } autoLoadMode = true; } SettingsManager Settings; ModelManager Manager; MainControler Controler(&Manager); MainView View(Manager.getPlaybackManager()->getPlaybackModel(), autoLoadMode); connect(app, SIGNAL(aboutToQuit()), this, SLOT(quitNocturn()) ); connect(app, SIGNAL(aboutToQuit()), &Controler, SLOT(quitNocturn())); Manager.getPlayListManager()->restorePlayListFromFiles(); if (autoLoadMode) { Manager.getPlayListManager()->autoLoadPath(path); } connect(Manager.getPlayListManager(), SIGNAL(CurrentSongChanged(const QString&)), &View, SLOT(updateWindowTitle(const QString&))); View.setFirstTab(); SysTrayIconWrapper Icon(View, *(Manager.getPlayListManager())); return app->exec(); }
void CSymellaAppUi::HandleResourceChangeL(TInt aType) { CAknAppUi::HandleResourceChangeL( aType ); if ( iTabGroup == NULL ) return; #ifdef EKA2 if ( aType == KAknsMessageSkinChange || aType == KEikDynamicLayoutVariantSwitch ) { TInt activaViewId = iTabGroup->TabIdFromIndex(iTabGroup->ActiveTabIndex()); View(TUid::Uid(activaViewId))->HandleViewRectChange(); View(TUid::Uid(activaViewId))->Redraw(); } #endif }
void MakeExtendedKahan ( ElementalMatrix<F>& A, Base<F> phi, Base<F> mu ) { EL_DEBUG_CSE typedef Base<F> Real; if( A.Height() != A.Width() ) LogicError("Extended Kahan matrices must be square"); const Int n = A.Height(); if( n % 3 != 0 ) LogicError("Dimension must be an integer multiple of 3"); const Int l = n / 3; if( !l || (l & (l-1)) ) LogicError("n/3 is not a power of two"); Int k=0; while( Int(1u<<k) < l ) ++k; if( phi <= Real(0) || phi >= Real(1) ) LogicError("phi must be in (0,1)"); if( mu <= Real(0) || mu >= Real(1) ) LogicError("mu must be in (0,1)"); // Start by setting A to the identity, and then modify the necessary // l x l blocks of its 3 x 3 partitioning. MakeIdentity( A ); unique_ptr<ElementalMatrix<F>> ABlock( A.Construct(A.Grid(),A.Root()) ); View( *ABlock, A, IR(2*l,3*l), IR(2*l,3*l) ); *ABlock *= mu; View( *ABlock, A, IR(0,l), IR(l,2*l) ); Walsh( *ABlock, k ); *ABlock *= -phi; View( *ABlock, A, IR(l,2*l), IR(2*l,3*l) ); Walsh( *ABlock, k ); *ABlock *= phi; // Now scale A by S const Real zeta = Sqrt(Real(1)-phi*phi); auto& ALoc = A.Matrix(); for( Int iLoc=0; iLoc<A.LocalHeight(); ++iLoc ) { const Int i = A.GlobalRow(iLoc); const Real gamma = Pow(zeta,Real(i)); for( Int jLoc=0; jLoc<A.LocalWidth(); ++jLoc ) ALoc(iLoc,jLoc) *= gamma; } }
inline void RLHF( int offset, const Matrix<R>& H, Matrix<R>& A ) { #ifndef RELEASE CallStackEntry entry("apply_packed_reflectors::RLHF"); if( offset > 0 || offset < -H.Width() ) throw std::logic_error("Transforms out of bounds"); if( H.Width() != A.Width() ) throw std::logic_error ("Width of transforms must equal width of target matrix"); #endif Matrix<R> HTL, HTR, H00, H01, H02, HPan, HPanCopy, HBL, HBR, H10, H11, H12, H20, H21, H22; Matrix<R> ALeft; Matrix<R> SInv, Z; LockedPartitionDownDiagonal ( H, HTL, HTR, HBL, HBR, 0 ); while( HTL.Height() < H.Height() && HTL.Width() < H.Width() ) { LockedRepartitionDownDiagonal ( HTL, /**/ HTR, H00, /**/ H01, H02, /*************/ /******************/ /**/ H10, /**/ H11, H12, HBL, /**/ HBR, H20, /**/ H21, H22 ); const int HPanWidth = H10.Width() + H11.Width(); const int HPanOffset = std::min( H11.Height(), std::max(-offset-H00.Height(),0) ); const int HPanHeight = H11.Height()-HPanOffset; LockedView ( HPan, H, H00.Height()+HPanOffset, 0, HPanHeight, HPanWidth ); View( ALeft, A, 0, 0, A.Height(), HPanWidth ); //--------------------------------------------------------------------// HPanCopy = HPan; MakeTrapezoidal( RIGHT, LOWER, offset, HPanCopy ); SetDiagonal( RIGHT, offset, HPanCopy, R(1) ); Syrk( UPPER, NORMAL, R(1), HPanCopy, SInv ); HalveMainDiagonal( SInv ); Gemm( NORMAL, TRANSPOSE, R(1), ALeft, HPanCopy, Z ); Trsm( RIGHT, UPPER, NORMAL, NON_UNIT, R(1), SInv, Z ); Gemm( NORMAL, NORMAL, R(-1), Z, HPanCopy, R(1), ALeft ); //--------------------------------------------------------------------// SlideLockedPartitionDownDiagonal ( HTL, /**/ HTR, H00, H01, /**/ H02, /**/ H10, H11, /**/ H12, /*************/ /******************/ HBL, /**/ HBR, H20, H21, /**/ H22 ); } }
//&>>&0 0 0 11 //&<<&mmm_KeyBoard::GetScan() { mmm_KeyBoard::GetScan() { unsigned char c; int cd=0; ioctl(con_fd,TIOCINQ,&cd); if(cd==0) View(); // Redraw screen only if system KB-buffer is empty read(con_fd,&c,1); // get next scancode from console return c; }
void BTwoDimensionalLayout::_ValidateMinMax() { fLocalLayouter->ValidateMinMax(); if (BView* view = View()) view->ResetLayoutInvalidation(); }
void BToolTip::Unlock() { if (fLockedLooper) View()->UnlockLooper(); else BToolTipManager::Manager()->Unlock(); }
inline View create_view( vsip::Domain<2> const& dom, typename View::block_type::map_type const& map = typename View::block_type::map_type()) { return View(dom[0].length(), dom[1].length(), map); }
void CNamedViewSubSession::ChangeSortOrderL(const RMessage2& aMessage) { RContactViewSortOrder newSortOrder; TContactViewPreferences contactsToInclude; UnpackageSortOrderL(aMessage,newSortOrder,contactsToInclude); View().ChangeSortOrderL(newSortOrder); newSortOrder.Close(); }