BOOL CBitprintsDownloader::DecodeResponse() { if ( m_pXML ) delete m_pXML; theApp.Message( MSG_DEBUG | MSG_FACILITY_INCOMING, L"[Bitprints] Got response: %s", (LPCTSTR)m_sResponse ); m_pXML = CXMLElement::FromString( m_sResponse, TRUE ); if ( m_pXML == NULL ) return FALSE; for ( POSITION pos = SchemaCache.GetIterator(); pos; ) { CSchemaPtr pSchema = SchemaCache.GetNext( pos ); if ( pSchema->m_sBitprintsTest.GetLength() && LookupValue( pSchema->m_sBitprintsTest ).GetLength() ) { CXMLElement* pMetadata = ImportData( pSchema ); if ( pMetadata == NULL ) return FALSE; return SubmitMetaData( pMetadata ); } } return FALSE; }
bool Actor::ImportDataAndNewID(const std::string& fileName){ ImportData(fileName); if (!mTransform){ return false; } mUniqueID = gUniqueIDGenerator.CreateUniqueID(); return true; }
BOOL CBitziDownloader::DecodeResponse() { if ( m_pXML ) delete m_pXML; m_pXML = CXMLElement::FromString( m_sResponse, TRUE ); if ( m_pXML == NULL ) return FALSE; for ( POSITION pos = SchemaCache.GetIterator() ; pos ; ) { CSchema* pSchema = SchemaCache.GetNext( pos ); if ( pSchema->m_sBitziTest.GetLength() && LookupValue( pSchema->m_sBitziTest ).GetLength() ) { CXMLElement* pMetadata = ImportData( pSchema ); if ( pMetadata == NULL ) return FALSE; return SubmitMetaData( pMetadata ); } } return FALSE; }
LRESULT CMemoryView::OnInfoProc(WPARAM wParam, LPARAM lParam){ ePipeline* Info = (ePipeline*)wParam; int64 Type = Info->PopInt(); int64 Cmd = Info->PopInt(); if (Type == INSTANCE_OBJECT) { if(Cmd == CREATE_INSTANCE){ ePipeline* ObjData = (ePipeline*)Info->GetData(0); CreateObjectInstance(ObjData); }else if (Cmd == NAME_INSTANCE) { tstring SrceObjectName = Info->PopString(); int64 InstanceID = Info->PopInt(); tstring InstanceName = Info->PopString(); NameObjectInstance(SrceObjectName,InstanceID,InstanceName); }else if (Cmd == CLOSE_INSTANCE) { tstring SrceObjectName = Info->PopString(); int64 InstanceID = Info->PopInt(); CloseObjectInstance(SrceObjectName,InstanceID); } } else if(Type == INSTANCE_DATA) { switch(Cmd){ case CREATE_INSTANCE: { tstring InstanceName = Info->PopString(); CreateDataInstance(InstanceName); } break; case INSERT_DATA: { tstring InstanceName = Info->PopString(); int32 Index = Info->PopInt(); ePipeline* Data = (ePipeline*)Info->GetData(0); InsertData(InstanceName,Index,Data); } break; case MODIFY_DATA: { tstring InstanceName = Info->PopString(); int32 Index = Info->PopInt(); ePipeline* Data = (ePipeline*)Info->GetData(0); ModifyData(InstanceName,Index,Data); } break; case REMOVE_DATA: { tstring InstanceName = Info->PopString(); int32 Index = Info->PopInt(); RemoveData(InstanceName,Index); } break; case CLOSE_INSTANCE: { tstring InstanceName = Info->PopString(); CloseDataInstance(InstanceName); } break; case IMPORT_DATA: { tstring InstanceName = Info->PopString(); ePipeline* DataList = (ePipeline*)Info->GetData(0); ImportData(InstanceName,DataList); } break; case EXPORT_DATA: { tstring InstanceName = Info->PopString(); ExportData(InstanceName); } break; default: assert(0); break; } } m_Toolbar.m_Owner = NULL; m_SpaceSelected = NULL; m_SpaceFocused = NULL; Layout(); return 0; }
int main() { //char filename[100]="new_data.dat"; int i,j; float *FT; float *ThPh; float *G; float *Gt; float *A; float *F; float *t; float *b; float *L; float *Lu; float *J; float *M; FILE *am; float *datas1; float *theta; //char *datas=""; char *punto1="punto4Cos.dat"; F=malloc(sizeof(float)*1000); t=malloc(sizeof(float)*1000); theta=malloc(sizeof(float)*1000); Gt=malloc(sizeof(float)*1000*2); A=malloc(sizeof(float)*3*3); b=malloc(sizeof(float)*3); L=malloc(sizeof(float)*3*3); Lu=malloc(sizeof(float)*3*3); J=malloc(sizeof(float)*3); M=malloc(sizeof(float)*3); am=malloc(sizeof(char)*1000); G=malloc(sizeof(float)*2000); FT=ImportData("Efes.txt",1000,2); for(i=0;i<1000;i++) { t[i]=FT[2*i]; F[i]=FT[2*i+1]; } for(i=0;i<1000;i++) { for(j=0;j<2;j++) { if(j==0) { G[i*3+j]=2*cos(t[i]); } else if(j==1) { G[i*3+j]=1; } } } Gt=Transpose(G,1000,2); A=MatrixMultiplication(Gt,G,2,1000,1000,2); b=MatrixMultiplication(Gt,F,2,1000,1000,1); L=Cholesky(A,2); Lu=Transpose(L,2,2); J=SolverL(L,b,J,2); M=SolverU(Lu,J,M,2); printf("M\n"); for (i=0;i<2;i++) { printf("%f\n",M[i]); } am=fopen(punto1,"a"); if(!am) { printf("problem opening"); } for(i=0;i<2;i++) { fprintf(am,"%f\t",M[i]); } fprintf(am,"\n"); fclose(am); return 0; }
BOOL CShareMonkeyData::DecodeResponse(CString& strMessage) { if ( m_pXML && m_nRequestType == stProductMatch ) Clear(); m_pXML = CXMLElement::FromString( m_sResponse, TRUE ); if ( m_pXML == NULL ) { strMessage = L"Invalid XML"; return FALSE; } bool bFailed = false; BOOL bResult = FALSE; CString strStatus, strWarnings; for ( POSITION pos = m_pXML->GetElementIterator() ; pos ; ) { CXMLElement* pElement = m_pXML->GetNextElement( pos ); if ( pElement->IsNamed( L"Version" ) ) { CString strVersion = pElement->GetValue(); float nVersion = 0; if ( _stscanf( strVersion, L"%f", &nVersion ) != 1 || nVersion > 1.5f ) { strMessage = L"Failed: Version mismatch."; Clear(); return FALSE; } } else if ( pElement->IsNamed( L"Status" ) ) { strStatus = pElement->GetValue(); if ( strStatus.CompareNoCase( L"success" ) != NULL ) { if ( m_nRequestType != stComparison ) bFailed = true; } } else if ( pElement->IsNamed( L"ShareMonkeyComparisonURL" ) ) { m_sComparisonURL = pElement->GetValue(); if ( m_sComparisonURL.IsEmpty() && m_nRequestType == stComparison ) { strMessage = L"Failed: No URL is available."; Clear(); return FALSE; } int curPos = 0, currToken = 0; CString strToken; while ( curPos != -1 ) { strToken = m_sComparisonURL.Tokenize( L"/", curPos ); if ( ++currToken == 3 ) { m_sSessionID = strToken; break; } } } else if ( pElement->IsNamed( L"Count" ) && m_nRequestType != stComparison ) { if ( pElement->GetValue() == L"0" ) bFailed = true; } else if ( pElement->IsNamed( L"Message" ) ) { strWarnings = pElement->GetValue(); } else if ( pElement->IsNamed( L"Product" ) && m_nRequestType == stProductMatch ) { bResult = ImportData( pElement ); } else if ( pElement->IsNamed( L"Store" ) && m_nRequestType == stStoreMatch ) { bResult = ImportData( pElement ) || bResult; } } strMessage = strStatus + L". " + strWarnings; Clear(); if ( bFailed ) return FALSE; if ( m_nRequestType == stComparison ) return TRUE; return bResult; }
int main(int argc, char **argv) { //char filename[100]="new_data.dat"; int i,j; float *YT; float *ThPh; float *G; float *Gt; float *A; float *Y; float *t; float *b; float *L; float *Lu; float *J; float *M; FILE *am; float *datas1; float *theta; char *datas="Theta_Phi.dat"; char *punto1="punto4.dat"; Y=malloc(sizeof(float)*38); t=malloc(sizeof(float)*38); theta=malloc(sizeof(float)*1000); Gt=malloc(sizeof(float)*38*2); A=malloc(sizeof(float)*3*3); b=malloc(sizeof(float)*3); L=malloc(sizeof(float)*3*3); Lu=malloc(sizeof(float)*3*3); J=malloc(sizeof(float)*3); M=malloc(sizeof(float)*3); am=malloc(sizeof(char)*1000); YT=ImportData("Efes.txt",39,2); datas1=ImportData(datas,1000,2); for(i=0;i<38;i++) { t[i]=YT[2*i]; Y[i]=YT[2*i+1]; } //printf("theta"); for(i=0;i<100;i++) { theta[i]=datas1[2*i]; // printf("%f \n",theta[i]); } for(i=0;i<38;i++) { for(j=0;j<3;j++) { if(j==0) { G[i*3+j]=1; } else if(j==1) { G[i*3+j]=t[i]; } else if(j==2) { G[i*3+j]=pow(t[i],2); } } } Gt=Transpose(G,38,3); A=MatrixMultiplication(Gt,G,3,38,38,3); b=MatrixMultiplication(Gt,Y,3,38,38,1); L=Cholesky(A,3); Lu=Transpose(L,3,3); J=SolverL(L,b,J,3); M=SolverU(Lu,J,M,3); printf("M\n"); for (i=0;i<3;i++) { printf("%f\n",M[i]); } am=fopen(punto1,"a"); if(!am) { printf("problem opening"); } for(i=0;i<3;i++) { fprintf(am,"%f\t",M[i]); } fprintf(am,"\n"); fclose(am); return 0; }