fft

LOJ 6487 基础FFT练习题

自古美人都是妖i 提交于 2020-01-22 17:45:53
Link 注意到 \(\sum a,\sum b\le10^6\) ,所以不同的 \(a,b\) 只有 \(10^3\) 级别。 因此我们预处理开根的结果,然后开桶记录有多少不同的 \(a,b\) 然后再暴力做就好了。 #include<cstdio> #include<cctype> using i64=long long; const int N=1000007; int abs(int x){return x<0? -x:x;} int read(){int x=0,c=getchar();while(!isdigit(c))c=getchar();while(isdigit(c))x=x*10+c-48,c=getchar();return x;} int sqrt[N],t1[N],t2[N],a[N],b[N]; int main() { for(int i=1;i<=1000;++i) sqrt[i*i]=i; for(int i=2;i<=1000000;++i) sqrt[i]=sqrt[i]? sqrt[i]:sqrt[i-1]; for(int t=read();t;--t) { int n=read(),c1=0,c2=0;i64 ans=0; for(int i=1,k;i<=n;++i) k=read(),t1[k]++?:a[++c1]=k; for

Would Richardson–Lucy deconvolution work for recovering the latent kernel?

半城伤御伤魂 提交于 2020-01-21 19:46:27
问题 I am aware that Richardson–Lucy deconvolution is for recovering the latent image, but suppose we have a noisy image and the original image. Can we find the kernel that caused the transformation? Below is a MATLAB code for Richardson-Lucy deconvolution and I am wondering if it is easy to modify and make it recover the kernel instead of the latent image . My thoughts are that we change the convolution options to valid so the output would represent the kernel, what do you think? function latent

Would Richardson–Lucy deconvolution work for recovering the latent kernel?

三世轮回 提交于 2020-01-21 19:42:54
问题 I am aware that Richardson–Lucy deconvolution is for recovering the latent image, but suppose we have a noisy image and the original image. Can we find the kernel that caused the transformation? Below is a MATLAB code for Richardson-Lucy deconvolution and I am wondering if it is easy to modify and make it recover the kernel instead of the latent image . My thoughts are that we change the convolution options to valid so the output would represent the kernel, what do you think? function latent

FFT/NTT/MTT学习笔记

夙愿已清 提交于 2020-01-21 14:28:26
FFT/NTT/MTT Tags:数学 作业部落 评论地址 前言 这是网上的优秀博客 并不建议初学者看我的博客,因为我也不是很了解FFT的具体原理 一、概述 两个多项式相乘,不用 \(N^2\) ,通过 \(FFT\) 可以把复杂度优化到 \(O(NlogN)\) , \(NTT\) 能够取模, \(MTT\) 可以对非 \(NTT\) 模数取模,相对来说 \(FFT\) 常数小些因为不要取模 二、我们来背板子(FFT) 先放一个板子( 洛谷P3803 【模板】多项式乘法(FFT) ) #include<iostream> #include<cstdio> #include<cstdlib> #include<cmath> using namespace std; const int MAXN=3000005; const double pi=acos(-1); int N,M,r[MAXN],l; struct Complex { double rl,im;//real part / imaginary part Complex(){rl=im=0;}//以下是初始化的板子,虽然不懂为什么可以这样写 Complex(double a,double b){rl=a,im=b;} Complex operator + (Complex B) {return Complex(rl+B

Splitting a DTMF signal from a wav file using Matlab

别等时光非礼了梦想. 提交于 2020-01-21 09:53:47
问题 Here is the context of the problem: I have a DTMF signal in wav format, I have to identify the number sequence it has encoded. I must do so using fast fourier transform in Matlab, implying that I read the wav file using wavread and to identify each number that is seperated by 40ms silence or more. Here is my code so far: [signal, fs] = wavread( 'C:\Temp\file.wav' ); % here, fs = 8000Hz N = 512; T = 1/fs; L = length( signal ) samples = fs / 1000 * 40 windows = floor(L / samples) t = (1:L)/fs;

HDU - 4609 指数型生成函数+FFT

情到浓时终转凉″ 提交于 2020-01-21 05:20:58
3-idiots Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10462 Accepted Submission(s): 3554 Problem Description King OMeGa catched three men who had been streaking in the street. Looking as idiots though, the three men insisted that it was a kind of performance art, and begged the king to free them. Out of hatred to the real idiots, the king wanted to check if they were lying. The three men were sent to the king’s forest, and each of them was asked to pick a branch one after another. If the three branches they bring back can form a

Pitch detection with computeSpectrum() return FFT values

无人久伴 提交于 2020-01-21 00:27:06
问题 I'm developing using Actionscript 3.0 for Flash Player 10.3 I'm using computeSpectrum() on a loaded .mp3 Running *Event.ENTER_FRAME* to get snapshots of each sample in an byteArray The ByteArray contains 512 values (256 for each channel). These values are FFT Spectrum, ranging from 0 to 1. I can't use the peak frequency for each of the samples (as I found found out!) because the highest value is not necessarily the fundamental frequency! As a result I'm getting lots of random values all over

傅立叶变换的意义

寵の児 提交于 2020-01-20 23:01:55
一、傅立叶变换的由来 关于傅立叶变换,无论是书本还是在网上可以很容易找到关于傅立叶变换的描述,但是大都是些故弄玄虚的文章,太过抽象,尽是一些让人看了就望而生畏的公式的罗列,让人很难能够从感性上得到理解,最近,我偶尔从网上看到一个关于数字信号处理的电子书籍,是一个叫 Steven W. Smith, Ph.D. 外国人写的,写得非常浅显,里面有七章由浅入深地专门讲述关于离散信号的傅立叶变换,虽然是英文文档,我还是硬着头皮看完了有关傅立叶变换的有关内容,看了有茅塞顿开的感觉,在此把我从中得到的理解拿出来跟大家分享,希望很多被傅立叶变换迷惑的朋友能够得到一点启发,这电子书籍是免费的,有兴趣的朋友也可以从网上下载下来看一下, URL 地址是: http://www.dspguide.com/pdfbook.htm 要理解傅立叶变换,确实需要一定的耐心,别一下子想着傅立叶变换是怎么变换的,当然,也需要一定的高等数学基础,最基本的是级数变换,其中傅立叶级数变换是傅立叶变换的基础公式。 二、傅立叶变换的提出 让我们先看看为什么会有傅立叶变换?傅立叶是一位法国数学家和物理学家的名字,英语原名是 Jean Baptiste Joseph Fourier (1768-1830) , Fourier 对热传递很感兴趣,于 1807 年在法国科学学会上发表了一篇论文,运用正弦曲线来描述温度分布

@bzoj - 4259@ 残缺的字符串

浪尽此生 提交于 2020-01-20 20:23:21
目录 @description@ @solution@ @accepted code@ @details@ @description@ 很久很久以前,在你刚刚学习字符串匹配的时候,有两个仅包含小写字母的字符串A和B,其中A串长度为m,B串长度为n。可当你现在再次碰到这两个串时,这两个串已经老化了,每个串都有不同程度的残缺。 你想对这两个串重新进行匹配,其中A为模板串,那么现在问题来了,请回答,对于B的每一个位置i,从这个位置开始连续m个字符形成的子串是否可能与A串完全匹配? 原题链接。 @solution@ 据说已经成了套路题。 以下内容中假定以 0 为字符串下标起点。 考虑没有通配符的情况,B 中第 j 个位置开头的串能否与 A 匹配。实际上是计算式子 \(\sum_{i=0}^{m-1}[A_i\not = B_{i+j}]\) 是否为 0。 注意到这个注意匹配的形式很像卷积。不过别急,我们先把其拆成数值计算的形式:上式为 0 等价于 \(\sum_{i=0}^{m-1}(A_i - B_{i+j})^2\) 。 由完全平方的非负性可以得到等价性。 有通配符怎么办?A, B 其中一个为通配符,构造出来的式子就应该等于 0。 不妨令通配符等于 0,则计算 \(\sum_{i=0}^{m-1}(A_i - B_{i+j})^2\times A_i \times B_{i+j}\)

Creating wave data from FFT data?

萝らか妹 提交于 2020-01-16 19:39:58
问题 As you might notice, i am really new to python and sound processing. I (hopefully) extracted FFT data from a wave file using python and the logfbank and mfcc function. (The logfbank seems to give the most promising data, mfcc output looked a bit weird for me). In my program i want to change the logfbank/mfcc data and then create wave data from it (and write them into a file). I didn't really find any information about the process of creating wave data from FFT data. Does anyone of you have an