Cpsc 440 Problem Set 4 Question 2

Cpsc 440 Problem Set 4 Question 2 - hw4p2.h #ifndef HW4P2_H...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
hw4p2.h 5/12/2008 # ifndef HW4P2_H # define HW4P2_H typedef struct ProblemParameters * ProblemParameters ; typedef double ( * f1ptr )( int ) ; typedef double ( * f2ptr )( int , int ) ; ProblemParameters newProblemParameters ( int n , double d , f1ptr fy , f2ptr fB ) ; void freeProblemParameters ( ProblemParameters p ) ; void iterateProblem ( ProblemParameters p ) ; void printProblemSolution ( ProblemParameters p , FILE * output_stream ) ; void printPartialSolution ( ProblemParameters p , FILE * output_stream , int * test_points , int num_points ) ; double y_i ( int i ) ; double A_ij ( int i , int j ) ; # endif 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
hw4p2.c 5/12/2008 # include < math . h > # include < stdio . h > # include < stdlib . h > # include "hw4p2.h" # define SOLUTION_ERROR_TOLERANCE 1e-15 # define CONST_N 10000 # define CONST_D 1e6 struct ProblemParameters { int n ; double d ; double * x ; double * y ; double * B ; double * Ax ; double * Bx ; double eps ; } ; ProblemParameters newProblemParameters ( int n , double d , f1ptr fy , f2ptr fB ) { ProblemParameters p = malloc ( sizeof ( struct ProblemParameters )) ; p - > n = n ; p - > d = d ; p - > x = malloc ( n * sizeof ( double )) ; p - > y = malloc ( n * sizeof ( double )) ; p - > B = malloc ( 2 * n * sizeof ( double )) ; p - > Ax = malloc ( n * sizeof ( double )) ; p - > Bx = malloc ( n * sizeof
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

Cpsc 440 Problem Set 4 Question 2 - hw4p2.h #ifndef HW4P2_H...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online