TEST_F(FourierTransformerGPUTest, FwdBwdFilterTest) { RealMatrix rmData(5,5), rmFilter(4,4); // MAGIC NUMBERS WHICH END UP AT 8x8 rmData << 17, 24, 1, 8, 15, 23, 5, 7, 14, 16, 4, 6, 13, 20, 22, 10, 12, 19, 21, 3, 11, 18, 25, 2, 9; rmFilter << 16, 2, 3, 13, 5, 11, 10, 8, 9, 7, 6, 12, 4, 14, 15, 1; RealMatrix rmDataPadded, rmFilterPadded; FourierPadder padder(5, 4); padder.padData(rmData,rmDataPadded); padder.padFilter(rmFilter,rmFilterPadded); ComplexMatrix cmData(ftfftw->rows_,ftfftw->cols_/2+1); ComplexMatrix cmFilter(ftfftw->rows_,ftfftw->cols_/2+1); cmData.setZero(); cmFilter.setZero(); ftfftw->forward(rmDataPadded,cmData); ftfftw->forward(rmFilterPadded,cmFilter); ComplexMatrix cmResult = cmData.cwiseProduct(cmFilter); ftfftw->backward(cmResult,rmDataPadded); rmDataPadded = rmDataPadded/(ftfftw->rows_*ftfftw->cols_); padder.extractDenseOutput(rmDataPadded,rmData); RealMatrix expectedResult(5,5); expectedResult << 831, 1224, 1338, 810, 784, 1360, 1779, 1366, 1473, 1159, 1422, 1400, 1847, 1615, 877, 944, 1423, 1462, 1315, 726, 811, 973, 1064, 751, 144; std::cout << rmData << std::endl; ASSERT_EQ(true,rmData.isApprox(expectedResult,0.000001)); }
//__________________________________________________________________________________ long DisplayListOfChoices (void) { ReadInTemplateFiles(); if (!availableTemplateFiles.lLength) return -1; long choice = -1; char buffer[2048]; _String fileAbbr, *thisLine; _SimpleList categoryDelimiters; _List categoryHeadings; for (choice = 0; choice< availableTemplateFiles.lLength; choice++) { thisLine = (_String*)(*(_List*)availableTemplateFiles(choice))(2); if (thisLine->sData[0]=='!') { categoryDelimiters<<choice; fileAbbr = *thisLine; fileAbbr.Trim (1,-1); categoryHeadings && &fileAbbr; } } choice = -1; if (categoryDelimiters.lLength==0) { while (choice == -1) { for (choice = 0; choice<availableTemplateFiles.lLength; choice++) { printf ("\n\t(%s):%s",((_String*)(*(_List*)availableTemplateFiles(choice))(0))->getStr(), ((_String*)(*(_List*)availableTemplateFiles(choice))(1))->getStr()); } printf ("\n\n Please type in the abbreviation for the file you want to use (or press ENTER to process custom batch file):"); fgets (buffer,2048,stdin); fgets (buffer,2048,stdin); fileAbbr = buffer; if (fileAbbr.FirstNonSpaceIndex()<0) return -1; fileAbbr.UpCase(); for (choice = 0; choice<availableTemplateFiles.lLength; choice++) { if (fileAbbr.Equal((_String*)(*(_List*)availableTemplateFiles(choice))(0))) break; } if (choice==availableTemplateFiles.lLength) choice=-1; } } else { long categNumber = -1; while (choice==-1) { if (categNumber<0) { _String header ("***************** TYPES OF STANDARD ANALYSES *****************"), verString (GetVersionString().getStr()); if (verString.sLength<header.sLength-2) { _String padder (128,true); long poop = (header.sLength-2-verString.sLength)/2; if (!poop) poop = 1; for (choice=0; choice<poop; choice++) padder << ' '; padder.Finalize(); verString = padder & '/' & verString & "\\" & padder; } printf ("\n\033[2J\033[H%s\n%s\n\n",verString.getStr(), header.getStr()); for (choice = 0; choice<categoryHeadings.lLength; choice++) printf ("\n\t(%ld) %s",choice+1,((_String*)categoryHeadings(choice))->getStr()); printf ("\n\n Please select type of analyses you want to list (or press ENTER to process custom batch file):"); fgets (buffer,2048,stdin); fileAbbr = buffer; if (logInputMode) loggedUserInputs && & fileAbbr; if (fileAbbr.FirstNonSpaceIndex()<0) return -1; choice = fileAbbr.toNum(); if ( choice>0 && choice<=categoryHeadings.lLength) categNumber = choice-1; } else { printf ("\n\033[2J\033[H ***************** FILES IN '%s' ***************** \n\n",((_String*)categoryHeadings(categNumber))->getStr()); long start = categoryDelimiters.lData[categNumber]+1, end = categNumber==categoryDelimiters.lLength-1?availableTemplateFiles.lLength:categoryDelimiters.lData[categNumber+1]; for (choice = start; choice<end; choice++) printf ("\n\t(%ld) %s",choice-start+1,((_String*)(*(_List*)availableTemplateFiles(choice))(1))->getStr()); printf ("\n\n Please select the file you want to use (or press ENTER to return to the list of analysis types):"); fileAbbr = *StringFromConsole (); if (logInputMode) loggedUserInputs && & fileAbbr; if (fileAbbr.FirstNonSpaceIndex()<0) categNumber = -1; else { choice = fileAbbr.toNum(); if ((choice>0 && choice<=end-start)) return start+choice-1; } } choice = -1; } } return choice; }