void LocalECPotential_CUDA::add(int groupID, RadialPotentialType* ppot, RealType z) { RadialPotentialType* savefunc = PPset[groupID]; LocalECPotential::add(groupID, ppot, z); RadialPotentialType* rfunc = PPset[groupID]; if (rfunc != savefunc) { // Setup CUDA spline SRSplines[groupID] = new TextureSpline(); // int np = 10001; // RealType rmax(20.0); // char fname[100]; // snprintf (fname, 100, "local_ecp_%d.dat", groupID); // FILE *fout = fopen (fname, "w"); int np = rfunc->size(); vector<RealType> scaledData(np); for (int ir=0; ir<np; ir++) { // double r = ((RealType)ir / (RealType)(np-1)) * rmax ; // scaledData[ir] = -z* rfunc->splint(r); // fprintf (stderr, "V(%1.5f) = %1.8f\n", r, scaledData[ir]); // fprintf (fout, "%16.10f %18.10e\n", r, // scaledData[ir]); scaledData[ir] = -z * (*rfunc)(ir); } // fclose(fout); //SRSplines[groupID]->set(&(scaledData[0]), np, 0.0, rmax); SRSplines[groupID]->set(&(scaledData[0]), rfunc->size(), rfunc->grid().rmin(), rfunc->grid().rmax()); } }
void FFTFrame::doFFT(const float* data) { AudioFloatArray scaledData(m_FFTSize); // veclib fft returns a result that is twice as large as would be expected. // Compensate for that by scaling the input by half so the FFT has the // correct scaling. float scale = 0.5f; VectorMath::vsmul(data, 1, &scale, scaledData.data(), 1, m_FFTSize); vDSP_ctoz((DSPComplex*)scaledData.data(), 2, &m_frame, 1, m_FFTSize / 2); vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_FORWARD); }