Update of /project/cl-gsl/cvsroot/cl-gsl/c In directory common-lisp.net:/tmp/cvs-serv15021
Modified Files: cwrapperstub.c Log Message: Added wrappers to matrix functions.
Date: Fri Apr 22 04:41:33 2005 Author: edenny
Index: cl-gsl/c/cwrapperstub.c diff -u cl-gsl/c/cwrapperstub.c:1.3 cl-gsl/c/cwrapperstub.c:1.4 --- cl-gsl/c/cwrapperstub.c:1.3 Tue Mar 15 04:19:08 2005 +++ cl-gsl/c/cwrapperstub.c Fri Apr 22 04:41:33 2005 @@ -533,3 +533,287 @@ gsl_vector_complex_float_set_all(v , *z); }
+ +/* ----------------------------------------------------------------- */ + +void wrap_gsl_matrix_complex_float_set(gsl_matrix_complex_float *m, + const size_t i, + const size_t j, + gsl_complex_float *z) +{ + m->data[2 * (i * m->tda + j)] = z->dat[0]; + m->data[(2 * (i * m->tda + j)) + 1] = z->dat[1]; +} + +void wrap_gsl_matrix_complex_set(gsl_matrix_complex *m, + const size_t i, + const size_t j, + gsl_complex *z) +{ + m->data[2 * (i * m->tda + j)] = z->dat[0]; + m->data[(2 * (i * m->tda + j)) + 1] = z->dat[1]; +} + +void wrap_gsl_matrix_complex_set_all(gsl_matrix_complex *m, + gsl_complex *z) +{ + gsl_matrix_complex_set_all(m , *z); +} + +void wrap_gsl_matrix_complex_float_set_all(gsl_matrix_complex_float *m, + gsl_complex_float *z) +{ + gsl_matrix_complex_float_set_all(m , *z); +} + +/* ----------------------------------------------------------------- */ + +int wrap_gsl_matrix_fwrite(char *fn, const gsl_matrix *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "wb"); + ret = gsl_matrix_fwrite(stream, m); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_fread(char *fn, gsl_matrix *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "rb"); + ret = gsl_matrix_fread(stream, m); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_fprintf(char *fn, const gsl_matrix *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "w"); + ret = gsl_matrix_fprintf(stream, m, "%lf"); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_fscanf(char *fn, gsl_matrix *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "r"); + ret = gsl_matrix_fscanf(stream, m); + fclose(stream); + + return ret; +} + +/* ----------------------------------------------------------------- */ + +int wrap_gsl_matrix_float_fwrite(char *fn, const gsl_matrix_float *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "wb"); + ret = gsl_matrix_float_fwrite(stream, m); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_float_fread(char *fn, gsl_matrix_float *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "rb"); + ret = gsl_matrix_float_fread(stream, m); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_float_fprintf(char *fn, const gsl_matrix_float *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "w"); + ret = gsl_matrix_float_fprintf(stream, m, "%f"); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_float_fscanf(char *fn, gsl_matrix_float *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "r"); + ret = gsl_matrix_float_fscanf(stream, m); + fclose(stream); + + return ret; +} + +/* ----------------------------------------------------------------- */ + +int wrap_gsl_matrix_int_fwrite(char *fn, const gsl_matrix_int *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "wb"); + ret = gsl_matrix_int_fwrite(stream, m); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_int_fread(char *fn, gsl_matrix_int *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "rb"); + ret = gsl_matrix_int_fread(stream, m); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_int_fprintf(char *fn, const gsl_matrix_int *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "w"); + ret = gsl_matrix_int_fprintf(stream, m, "%d"); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_int_fscanf(char *fn, gsl_matrix_int *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "r"); + ret = gsl_matrix_int_fscanf(stream, m); + fclose(stream); + + return ret; +} + +/* ----------------------------------------------------------------- */ + +int wrap_gsl_matrix_complex_fwrite(char *fn, const gsl_matrix_complex *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "wb"); + ret = gsl_matrix_complex_fwrite(stream, m); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_complex_fread(char *fn, gsl_matrix_complex *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "rb"); + ret = gsl_matrix_complex_fread(stream, m); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_complex_fprintf(char *fn, const gsl_matrix_complex *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "w"); + ret = gsl_matrix_complex_fprintf(stream, m, "%lf"); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_complex_fscanf(char *fn, gsl_matrix_complex *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "r"); + ret = gsl_matrix_complex_fscanf(stream, m); + fclose(stream); + + return ret; +} + +/* ----------------------------------------------------------------- */ + +int wrap_gsl_matrix_complex_float_fwrite(char *fn, + const gsl_matrix_complex_float *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "wb"); + ret = gsl_matrix_complex_float_fwrite(stream, m); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_complex_float_fread(char *fn, gsl_matrix_complex_float *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "rb"); + ret = gsl_matrix_complex_float_fread(stream, m); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_complex_float_fprintf(char *fn, + const gsl_matrix_complex_float *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "w"); + ret = gsl_matrix_complex_float_fprintf(stream, m, "%lf"); + fclose(stream); + + return ret; +} + +int wrap_gsl_matrix_complex_float_fscanf(char *fn, gsl_matrix_complex_float *m) +{ + FILE* stream; + int ret; + + stream = fopen(fn, "r"); + ret = gsl_matrix_complex_float_fscanf(stream, m); + fclose(stream); + + return ret; +}