Skip to content
Snippets Groups Projects
Commit a1ed7804 authored by Christoph Sprunk's avatar Christoph Sprunk
Browse files

fixed some warnings

parent 19460423
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,7 @@ gsl_vector * vector_from_array(unsigned int n, double *x) { ...@@ -34,7 +34,7 @@ gsl_vector * vector_from_array(unsigned int n, double *x) {
//} //}
void vector_to_array(const gsl_vector*v, double*x){ void vector_to_array(const gsl_vector*v, double*x){
size_t i; int i;
for(i=0;i<v->size();i++) for(i=0;i<v->size();i++)
x[i] = gvg(v,i); x[i] = gvg(v,i);
} }
......
...@@ -171,7 +171,7 @@ val egsl_alloc(size_t rows, size_t columns) { ...@@ -171,7 +171,7 @@ val egsl_alloc(size_t rows, size_t columns) {
int index = c->nvars; int index = c->nvars;
if(index<c->nallocated) { if(index<c->nallocated) {
gsl_matrix*m = c->vars[index].gsl_m; gsl_matrix*m = c->vars[index].gsl_m;
if(m->rows() == rows && m->cols() == columns) { if((size_t) m->rows() == rows && (size_t) m->cols() == columns) {
egsl_cache_hits++; egsl_cache_hits++;
c->nvars++; c->nvars++;
return assemble_val(cid,index,c->vars[index].gsl_m); return assemble_val(cid,index,c->vars[index].gsl_m);
...@@ -204,7 +204,7 @@ val egsl_alloc_in_context(int context, size_t rows, size_t columns) { ...@@ -204,7 +204,7 @@ val egsl_alloc_in_context(int context, size_t rows, size_t columns) {
int index = c->nvars; int index = c->nvars;
if(index<c->nallocated) { if(index<c->nallocated) {
gsl_matrix*m = c->vars[index].gsl_m; gsl_matrix*m = c->vars[index].gsl_m;
if(m->rows() == rows && m->cols() == columns) { if((size_t) m->rows() == rows && (size_t) m->cols() == columns) {
egsl_cache_hits++; egsl_cache_hits++;
c->nvars++; c->nvars++;
return assemble_val(context,index,c->vars[index].gsl_m); return assemble_val(context,index,c->vars[index].gsl_m);
...@@ -256,7 +256,7 @@ val egsl_promote(val v) { ...@@ -256,7 +256,7 @@ val egsl_promote(val v) {
void egsl_expect_size(val v, size_t rows, size_t cols) { void egsl_expect_size(val v, size_t rows, size_t cols) {
gsl_matrix * m = egsl_gslm(v); gsl_matrix * m = egsl_gslm(v);
int bad = (rows && (m->rows()!=rows)) || (cols && (m->cols()!=cols)); int bad = (rows && ((size_t) m->rows()!=rows)) || (cols && ((size_t) m->cols()!=cols));
if(bad) { if(bad) {
fprintf(stderr, "Matrix size is %d,%d while I expect %d,%d", fprintf(stderr, "Matrix size is %d,%d while I expect %d,%d",
(int)m->rows(),(int)m->cols(),(int)rows,(int)cols); (int)m->rows(),(int)m->cols(),(int)rows,(int)cols);
...@@ -268,7 +268,7 @@ void egsl_expect_size(val v, size_t rows, size_t cols) { ...@@ -268,7 +268,7 @@ void egsl_expect_size(val v, size_t rows, size_t cols) {
void egsl_print(const char*str, val v) { void egsl_print(const char*str, val v) {
gsl_matrix * m = egsl_gslm(v); gsl_matrix * m = egsl_gslm(v);
size_t i,j; int i,j;
int context = its_context(v); int context = its_context(v);
int var_index = its_var_index(v); int var_index = its_var_index(v);
fprintf(stderr, "%s = (%d x %d) context=%d index=%d\n", fprintf(stderr, "%s = (%d x %d) context=%d index=%d\n",
...@@ -300,7 +300,7 @@ double* egsl_atmp(val v, size_t i, size_t j) { ...@@ -300,7 +300,7 @@ double* egsl_atmp(val v, size_t i, size_t j) {
double egsl_norm(val v1){ double egsl_norm(val v1){
egsl_expect_size(v1, 0, 1); egsl_expect_size(v1, 0, 1);
double n=0; double n=0;
size_t i; int i;
gsl_matrix * m = egsl_gslm(v1); gsl_matrix * m = egsl_gslm(v1);
for(i=0;i<m->rows();i++) { for(i=0;i<m->rows();i++) {
double v = gsl_matrix_get(m,i,0); double v = gsl_matrix_get(m,i,0);
...@@ -320,7 +320,6 @@ double egsl_atv(val v1, size_t i){ ...@@ -320,7 +320,6 @@ double egsl_atv(val v1, size_t i){
void egsl_free_unused_memory(){ void egsl_free_unused_memory(){
int c; int c;
int freecounter = 0;
for(c=0;c<=max_cid;c++) { for(c=0;c<=max_cid;c++) {
for(int i=egsl_contexts[c].nvars; i<egsl_contexts[c].nallocated; i++){ for(int i=egsl_contexts[c].nvars; i<egsl_contexts[c].nallocated; i++){
gsl_matrix_free(egsl_contexts[c].vars[i].gsl_m); gsl_matrix_free(egsl_contexts[c].vars[i].gsl_m);
......
...@@ -17,7 +17,7 @@ val egsl_compose_col(val v1, val v2){ ...@@ -17,7 +17,7 @@ val egsl_compose_col(val v1, val v2){
egsl_expect_size(v2, 0, m1->cols()); egsl_expect_size(v2, 0, m1->cols());
val v3 = egsl_alloc(m1->rows()+m2->rows(),m1->cols()); val v3 = egsl_alloc(m1->rows()+m2->rows(),m1->cols());
gsl_matrix *m3 = egsl_gslm(v3); gsl_matrix *m3 = egsl_gslm(v3);
size_t i,j; int i,j;
for(j=0;j<m1->cols();j++) { for(j=0;j<m1->cols();j++) {
for(i=0;i<m1->rows();i++) for(i=0;i<m1->rows();i++)
gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j)); gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j));
...@@ -34,7 +34,7 @@ val egsl_compose_row(val v1, val v2){ ...@@ -34,7 +34,7 @@ val egsl_compose_row(val v1, val v2){
egsl_expect_size(v2, m1->rows(), 0); egsl_expect_size(v2, m1->rows(), 0);
val v3 = egsl_alloc(m1->rows(), m1->cols() + m2->cols()); val v3 = egsl_alloc(m1->rows(), m1->cols() + m2->cols());
gsl_matrix *m3 = egsl_gslm(v3); gsl_matrix *m3 = egsl_gslm(v3);
size_t i,j; int i,j;
for(i=0;i<m1->rows();i++) { for(i=0;i<m1->rows();i++) {
for(j=0;j<m1->cols();j++) for(j=0;j<m1->cols();j++)
gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j)); gsl_matrix_set(m3, i, j, gsl_matrix_get(m1,i,j));
...@@ -59,7 +59,7 @@ void egsl_add_to_col(val v1, size_t j, val v2) { ...@@ -59,7 +59,7 @@ void egsl_add_to_col(val v1, size_t j, val v2) {
/* printf("m1 size = %d,%d j = %d\n",m1->rows(),m1->cols(),j); */ /* printf("m1 size = %d,%d j = %d\n",m1->rows(),m1->cols(),j); */
egsl_expect_size(v2, m1->rows(), 1); egsl_expect_size(v2, m1->rows(), 1);
size_t i; int i;
for(i=0;i<m1->rows();i++) { for(i=0;i<m1->rows();i++) {
*gsl_matrix_ptr(m1, i, j) += gsl_matrix_get(m2,i,0); *gsl_matrix_ptr(m1, i, j) += gsl_matrix_get(m2,i,0);
} }
......
...@@ -84,7 +84,7 @@ double m_dot(const gsl_matrix*A,const gsl_matrix*B) { ...@@ -84,7 +84,7 @@ double m_dot(const gsl_matrix*A,const gsl_matrix*B) {
//} //}
int poly_greatest_real_root(unsigned int n, const double*a, double *root) { int poly_greatest_real_root(int n, const double*a, double *root) {
// unsigned int i; // unsigned int i;
// //
// double z[(n-1)*2]; // double z[(n-1)*2];
...@@ -115,7 +115,7 @@ int poly_greatest_real_root(unsigned int n, const double*a, double *root) { ...@@ -115,7 +115,7 @@ int poly_greatest_real_root(unsigned int n, const double*a, double *root) {
// } // }
Eigen::VectorXd poly_coeffs(n); Eigen::VectorXd poly_coeffs(n);
for(unsigned int i=0; i<n; i++){ for(int i=0; i<n; i++){
poly_coeffs(i) = a[i]; poly_coeffs(i) = a[i];
} }
if(n!=5){ if(n!=5){
......
...@@ -26,7 +26,7 @@ double m_det(const gsl_matrix*A); ...@@ -26,7 +26,7 @@ double m_det(const gsl_matrix*A);
/* Returns the real part of the roots in roots */ /* Returns the real part of the roots in roots */
//int poly_real_roots(unsigned int n, const double*a, double *roots); //int poly_real_roots(unsigned int n, const double*a, double *roots);
int poly_greatest_real_root(unsigned int n, const double*a, double *root); int poly_greatest_real_root(int n, const double*a, double *root);
void m_display(const char*str, gsl_matrix*m); void m_display(const char*str, gsl_matrix*m);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment