Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4619400
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:25:10+00:00 2026-05-22T02:25:10+00:00

I’m trying to write a simple FFTW routine (version 2), and I think I’ve

  • 0

I’m trying to write a simple FFTW routine (version 2), and I think I’ve just about got the bones down, but I’m running into a persistent segfault when I call the fftwnd_one function (I’m doing a one dimensional transform, but I’m using the n-dimensional code for modularity’s sake). However, I believe my problem to be in the plan creation; could anyone offer some insight as to what’s wrong with this code? I’d greatly appreciate it if so – thank you!

For reference, the function that I’m working with here is sin(x). I realize that not all of the mathematical operations have been implemented, I’m just trying to get the FFTW2 library working first, then I can make the data useful.

#include <stdio.h>
#include <fftw.h>
#include <math.h>
#include <complex.h>

int main(){
  int i;
  fftw_complex in[8];
  fftwnd_plan p;
  const int *n;
  int temp = (int)pow(2, 2)*pow(3,2)*pow(5,1)*pow(7,1)*pow(11,1)*pow(13,0);
  n = &temp;

  in[0].re = 0;
  in[1].re = (sqrt(2)/2);
  in[2].re = 1;
  in[3].re = (sqrt(2)/2);
  in[4].re = 0;
  in[5].re = -(sqrt(2)/2);
  in[6].re = -1;
  in[7].re = -(sqrt(2)/2);

  for(i = 0; i < 8; i++){
    (in[i]).im = 0;
  }

  p = fftwnd_create_plan(8, n, FFTW_FORWARD, FFTW_ESIMATE | FFTW_IN_PLACE);
  fftwnd_one(p, &in[0], NULL);
  fftwnd_destroy_plan(p);

  printf("Sin\n");
  for(i = 0; i < 8; i++){
    printf("%d\n", n[i]);
  }
  return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:25:10+00:00Added an answer on May 22, 2026 at 2:25 am

    The first two parameters to fftwnd_create_plan look completely wrong. It seems you just want to create a plan for 1D FFT with size 8 (which raises the question as to why you’re using fftwnd_create_plan if you only need a 1D FFT ?). The call should be something like:

    const int n = 8;
    p = fftwnd_create_plan(1,   // rank = 1, i.e. 1D
                           &n,  // size of first (and only) dimension = n = 8
                           FFTW_FORWARD,
                           FFTW_ESIMATE | FFTW_IN_PLACE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.