int CNNFilter::Compress(int nInput) { // convert the input to a short and store it m_rbInput[0] = GetSaturatedShortFromInt(nInput); // figure a dot product int nDotProduct; if (m_bMMXAvailable) nDotProduct = CalculateDotProduct(&m_rbInput[-m_nOrder], &m_paryM[0], m_nOrder); else nDotProduct = CalculateDotProductNoMMX(&m_rbInput[-m_nOrder], &m_paryM[0], m_nOrder); // calculate the output int nOutput = nInput - ((nDotProduct + (1 << (m_nShift - 1))) >> m_nShift); // adapt if (m_bMMXAvailable) Adapt(&m_paryM[0], &m_rbDeltaM[-m_nOrder], -nOutput, m_nOrder); else AdaptNoMMX(&m_paryM[0], &m_rbDeltaM[-m_nOrder], nOutput, m_nOrder); int nTempABS = abs(nInput); if (nTempABS > (m_nRunningAverage * 3)) m_rbDeltaM[0] = ((nInput >> 25) & 64) - 32; else if (nTempABS > (m_nRunningAverage * 4) / 3)
static inline void compute(BM& A, BM& B, const typename BM::value_type& ts = 0.) { BoostMatrixTraits<int>::BoostVecType ipiv(A.size1()); //pivoting //! use adaptor boost::numeric::ublas::symmetric_adaptor<BM, UL> Adapt(A); //std::cout << Adapt.size1() << "\t" << Adapt.size2() << std::endl; boost::numeric::bindings::lapack::sysv(Adapt, ipiv, B); }
int Tracker::Ini(void) { int iResult = 0; bool TransmitMulticast = false; std::string HostName = "147.46.175.54:801";//"localhost:801"; // Connect to a server std::cout << "Connecting to " << HostName << " ..." << std::flush; while( !MyClient.IsConnected().Connected ) { // Direct connection MyClient.Connect( HostName ); std::cout << "."; Sleep( 200 ); } std::cout<<std::endl; MyClient.EnableSegmentData(); MyClient.EnableMarkerData(); MyClient.EnableUnlabeledMarkerData(); MyClient.EnableDeviceData(); std::cout << "Segment Data Enabled: " << Adapt( MyClient.IsSegmentDataEnabled().Enabled ) << std::endl; std::cout << "Marker Data Enabled: " << Adapt( MyClient.IsMarkerDataEnabled().Enabled ) << std::endl; std::cout << "Unlabeled Marker Data Enabled: " << Adapt( MyClient.IsUnlabeledMarkerDataEnabled().Enabled ) << std::endl; std::cout << "Device Data Enabled: " << Adapt( MyClient.IsDeviceDataEnabled().Enabled ) << std::endl; // Set the streaming mode MyClient.SetStreamMode( ViconDataStreamSDK::CPP::StreamMode::ClientPull ); MyClient.SetAxisMapping( Direction::Forward, Direction::Right, Direction::Down ); // Z-down Output_GetAxisMapping _Output_GetAxisMapping = MyClient.GetAxisMapping(); std::cout << "Axis Mapping: X-" << Adapt( _Output_GetAxisMapping.XAxis ) << " Y-" << Adapt( _Output_GetAxisMapping.YAxis ) << " Z-" << Adapt( _Output_GetAxisMapping.ZAxis ) << std::endl; // Discover the version number Output_GetVersion _Output_GetVersion = MyClient.GetVersion(); std::cout << "Version: " << _Output_GetVersion.Major << "." << _Output_GetVersion.Minor << "." << _Output_GetVersion.Point << std::endl; if( TransmitMulticast ) { MyClient.StartTransmittingMulticast( "localhost", "224.0.0.0" ); } // Here Start the Polling loop hTrackerPollingThread = CreateThread(NULL, 0, TrackerPollingThreadFunc, this, 0, NULL); return iResult; }
static inline void compute( BM& A, BM& B, const typename BM::value_type& ts = 10 * std::numeric_limits< typename BM::value_type>::epsilon()) { //! use adaptor typedef Norm<Constants<value_type>::NORMRCOND, value_type> RCondNormType; boost::numeric::ublas::symmetric_adaptor<BM, UL> Adapt(A); //value_type rcond = -1; //up to machine precision value_type anorm = RCondNormType::norm(Adapt); boost::numeric::bindings::lapack::potrf(Adapt); boost::numeric::bindings::lapack::pocon(Adapt, anorm, rcond);//!calc. rcond boost::numeric::bindings::lapack::potrs(Adapt, B); //!robustification: see RIPPA [1], p. 206., mid of page //!if the reciprocal cond. number <I>rcond</I> is near 1.0 the matrix is well-conditioned. Else if \f$ rcond \approx 0.0\f$ then the matrix is ill-conditioned. Despite its computational efficiency, rcond isn't much reliable. //std::cout << "rcond = "<<rcond << " eps = "<< std::numeric_limits<value_type>::epsilon()<< std::endl; }
static inline void compute(BM& A, BM& B, const typename BM::value_type& ts = 0.) { //! use adaptor boost::numeric::ublas::symmetric_adaptor<BM, UL> Adapt(A); boost::numeric::bindings::lapack::posv(Adapt, B); }