資源簡介
目前FFW的最新版本!
Windows下FFTW庫的使用 FFTW由麻省理工學院計算機科學實驗室超級計算技術組開發的一套離散傅立葉變換(DFT)的計算庫,開源、高效和標準C語言編寫.
世界上最快的快速傅里葉變換庫,著名的MIT開發的,據說MATLAB 就是采用的這個類庫。它包含一維和二維的實數和復數的傅里葉變換,非常好用!
代碼片段和文件信息
/*
?*?Copyright?(c)?2003?2007-11?Matteo?Frigo
?*?Copyright?(c)?2003?2007-11?Massachusetts?Institute?of?Technology
?*
?*?This?program?is?free?software;?you?can?redistribute?it?and/or?modify
?*?it?under?the?terms?of?the?GNU?General?Public?License?as?published?by
?*?the?Free?Software?Foundation;?either?version?2?of?the?License?or
?*?(at?your?option)?any?later?version.
?*
?*?This?program?is?distributed?in?the?hope?that?it?will?be?useful
?*?but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
?*?MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the
?*?GNU?General?Public?License?for?more?details.
?*
?*?You?should?have?received?a?copy?of?the?GNU?General?Public?License
?*?along?with?this?program;?if?not?write?to?the?Free?Software
?*?Foundation?Inc.?59?Temple?Place?Suite?330?Boston?MA??02111-1307??USA
?*
?*/
#include?“api.h“
static?plan?*mkplan0(planner?*plnr?unsigned?flags?
?????const?problem?*prb?int?hash_info?
?????wisdom_state_t?wisdom_state)
{
?????/*?map?API?flags?into?FFTW?flags?*/
?????X(mapflags)(plnr?flags);
?????plnr->flags.hash_info?=?hash_info;
?????plnr->wisdom_state?=?wisdom_state;
?????/*?create?plan?*/
?????return?plnr->adt->mkplan(plnr?prb);
}
static?unsigned?force_estimator(unsigned?flags)
{
?????flags?&=?~(FFTW_MEASURE?|?FFTW_PATIENT?|?FFTW_EXHAUSTIVE);
?????return?(flags?|?FFTW_ESTIMATE);
}
static?plan?*mkplan(planner?*plnr?unsigned?flags?
????const?problem?*prb?int?hash_info)
{
?????plan?*pln;
?????pln?=?mkplan0(plnr?flags?prb?hash_info?WISDOM_NORMAL);
?????if?(plnr->wisdom_state?==?WISDOM_NORMAL?&&?!pln)?{
??/*?maybe?the?planner?failed?because?of?inconsistent?wisdom;
?????plan?again?ignoring?infeasible?wisdom?*/
??pln?=?mkplan0(plnr?force_estimator(flags)?prb?
hash_info?WISDOM_IGNORE_INFEASIBLE);
?????}
?????if?(plnr->wisdom_state?==?WISDOM_IS_BOGUS)?{
??/*?if?the?planner?detected?a?wisdom?inconsistency
?????forget?all?wisdom?and?plan?again?*/
??plnr->adt->forget(plnr?FORGET_EVERYTHING);
??A(!pln);
??pln?=?mkplan0(plnr?flags?prb?hash_info?WISDOM_NORMAL);
??if?(plnr->wisdom_state?==?WISDOM_IS_BOGUS)?{
???????/*?if?it?still?fails?plan?without?wisdom?*/
???????plnr->adt->forget(plnr?FORGET_EVERYTHING);
???????A(!pln);
???????pln?=?mkplan0(plnr?force_estimator(flags)?
?????prb?hash_info?WISDOM_IGNORE_ALL);
??}
?????}
?????return?pln;
}
apiplan?*X(mkapiplan)(int?sign?unsigned?flags?problem?*prb)
{
?????apiplan?*p?=?0;
?????plan?*pln;
?????unsigned?flags_used_for_planning;
?????planner?*plnr?=?X(the_planner)();
?????unsigned?int?pats[]?=?{FFTW_ESTIMATE?FFTW_MEASURE
????FFTW_PATIENT?FFTW_EXHAUSTIVE};
?????int?pat?pat_max;
?????double?pcost?=?0;
?????if?(flags?&?FFTW_WISDOM_ONLY)?{
??/*?Special?mode?that?returns?a?plan?only?if?wisdom?is?present
?????and?returns?0?otherwise.??This?is?now?documented?in?the?manual
?????as?a?way?to?detect?whether?wisdom?is?available?for?a?problem.?*/
??flags_used_for_planning?=?flags;
??pln?=?mkplan
評論
共有 條評論