StreamConstants* getStreamConstants(const AstronomyParameters* ap, const Streams* streams) { int i; StreamConstants* sc; real stream_sigma; real sigma_sq2; sc = (StreamConstants*) mwMallocA(streams->number_streams * sizeof(StreamConstants)); for (i = 0; i < streams->number_streams; ++i) { stream_sigma = streams->parameters[i].sigma; if (stream_sigma == 0.0) { mw_printf("stream sigma 0.0 is invalid\n"); mwFreeA(sc); return NULL; } sc[i].large_sigma = (stream_sigma > SIGMA_LIMIT || stream_sigma < -SIGMA_LIMIT); sigma_sq2 = 2.0 * sqr(stream_sigma); sc[i].sigma_sq2_inv = 1.0 / sigma_sq2; sc[i].a = streamA(&streams->parameters[i]); sc[i].c = streamC(ap, ap->wedge, streams->parameters[i].mu, streams->parameters[i].r); } return sc; }
StreamConstants* getStreamConstants(const AstronomyParameters* ap, const Streams* streams) { unsigned int i; StreamConstants* sc; real stream_sigma; real sigma_sq2; sc = (StreamConstants*) mwMallocA(sizeof(StreamConstants) * streams->number_streams); for (i = 0; i < streams->number_streams; i++) { stream_sigma = streams->parameters[i].sigma; sc[i].large_sigma = (stream_sigma > SIGMA_LIMIT || stream_sigma < -SIGMA_LIMIT); sigma_sq2 = 2.0 * sqr(stream_sigma); sc[i].sigma_sq2_inv = 1.0 / sigma_sq2; sc[i].a = streamA(&streams->parameters[i]); sc[i].c = streamC(ap, ap->wedge, streams->parameters[i].mu, streams->parameters[i].r); } return sc; }
Matrix::Matrix(int x) { if(x==1) { // Input Popup cout << "Enter 1 to open INPUT.txt"; int a; while(1) { cin >> a; if(a==1) { system("start INPUT.txt"); break; } else cout << "Enter a valid number"; } while(1) { cout << "Enter 2 after saving and closing Notepad, after inputting your desired matrix"; cin >> a; if (a==2) break; else cout << "Enter a valid number"<<endl; } // Converting Input to matrix string lineA; int rowA=0,colA=0; double x,input[10][10]= {{0}}; ifstream fileIN; fileIN.open("INPUT.txt"); if(fileIN.fail()) { cerr << "*File you are trying to access cannot be found/opened:"; exit(1); } while(fileIN.good()) { while(getline(fileIN,lineA)) { istringstream streamA(lineA); colA=0; while(streamA >> x) { input[rowA][colA]=x; colA++; } rowA++; } } Rows=rowA; Columns=colA; for (int i=0; i<rowA; i++) { for (int j=0; j<colA; j++) { matrix[i][j]=input[i][j]; } } }