Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* You need three files: */
- /*---------------------------*/
- /* b.h */
- #include <stdio.h>
- #include <gsl/gsl_vector.h>
- struct output_template{
- gsl_vector *v1;
- gsl_vector *v2;
- };
- struct output_template afunc();
- /*---------------------------*/
- /* b.c */
- #include <stdio.h>
- #include <gsl/gsl_vector.h>
- #include "b.h"
- struct output_template afunc(){
- struct output_template output;
- output.v1=gsl_vector_alloc(2);
- output.v2=gsl_vector_alloc(2);
- gsl_vector_set(output.v1,0,0.2);
- gsl_vector_set(output.v1,1,5.7);
- gsl_vector_set(output.v2,0,-0.2);
- gsl_vector_set(output.v2,1,1.5);
- return output;
- }
- /*---------------------------*/
- /* c.c */
- #include <stdio.h>
- #include <gsl/gsl_vector.h>
- #include "b.h"
- int main()
- {
- struct output_template output=afunc();
- printf("v1_1=%.5f\n",gsl_vector_get(output.v1,0));
- return(0);
- }
- /*---------------------------*/
- /*---Compile these files-----*/
- /*--- I use mkl for cblas needed by gsl -----*/
- icc -c b.c
- icc -c c.c
- icc -o c.out b.o c.o -mkl -lgsl
- /*---------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement