Skip to content

Commit

Permalink
use free_matrix instead of destroy_matrix and adjust swig in typemaps
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Nov 14, 2011
1 parent 54fc133 commit 0ef3680
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/interfaces/csharp_modular/swig_typemaps.i
Expand Up @@ -113,7 +113,7 @@ TYPEMAP_SGVECTOR(float64_t, double, double)
array[i] = (SGTYPE)$input[i];
}

$1 = shogun::SGMatrix<SGTYPE>(array, rows, cols);
$1 = shogun::SGMatrix<SGTYPE>(array, rows, cols, true);
}

%typemap(out) shogun::SGMatrix<SGTYPE>
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/java_modular/swig_typemaps.i
Expand Up @@ -356,7 +356,7 @@ TYPEMAP_SGVECTOR(float64_t, double, Double, jdouble, "toDoubleArray", "()[[D", "

cols = (int32_t)JCALL2(CallIntMethod, jenv, $input, mid);

$1 = shogun::SGMatrix<SGTYPE>((SGTYPE*)array, rows, cols);
$1 = shogun::SGMatrix<SGTYPE>((SGTYPE*)array, rows, cols, true);
}

%typemap(out) shogun::SGMatrix<SGTYPE>
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/lua_modular/swig_typemaps.i
Expand Up @@ -226,7 +226,7 @@ TYPEMAP_SGVECTOR(float64_t)
lua_pop(L, 1);
}

$1 = shogun::SGMatrix<SGTYPE>((SGTYPE*)array, rows, cols);
$1 = shogun::SGMatrix<SGTYPE>((SGTYPE*)array, rows, cols, true);
}

%typemap(out) shogun::SGMatrix<SGTYPE> {
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/octave_modular/swig_typemaps.i
Expand Up @@ -129,7 +129,7 @@ TYPEMAP_OUT_SGVECTOR(uint16NDArray, uint16_t, uint16_t, "Word")
m = mat_feat.oct_converter();

void* copy=get_copy((void*) m.fortran_vec(), size_t(m.cols())*m.rows()*sizeof(sg_type));
$1 = shogun::SGMatrix<sg_type>((sg_type*) copy, m.rows(), m.cols());
$1 = shogun::SGMatrix<sg_type>((sg_type*) copy, m.rows(), m.cols(), true);
}
%typemap(freearg) shogun::SGMatrix<sg_type>
{
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/python_modular/swig_typemaps.i
Expand Up @@ -248,7 +248,7 @@ TYPEMAP_OUT_SGVECTOR(PyObject, NPY_OBJECT)
SWIG_fail;

$1 = shogun::SGMatrix<type>((type*) PyArray_BYTES(array),
PyArray_DIM(array,0), PyArray_DIM(array,1));
PyArray_DIM(array,0), PyArray_DIM(array,1), true);

((PyArrayObject*) array)->flags &= (-1 ^ NPY_OWNDATA);
Py_DECREF(array);
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ruby_modular/swig_typemaps.i
Expand Up @@ -127,7 +127,7 @@ TYPEMAP_SGVECTOR(float64_t, NUM2DBL, rb_float_new)
else {
rb_raise(rb_eArgError, "Expected Arrays");
}
$1 = shogun::SGMatrix<SGTYPE>((SGTYPE*)array, rows, cols);
$1 = shogun::SGMatrix<SGTYPE>((SGTYPE*)array, rows, cols, true);
}

%typemap(out) shogun::SGMatrix<SGTYPE> {
Expand Down
4 changes: 2 additions & 2 deletions src/shogun/kernel/CustomKernel.h
Expand Up @@ -247,8 +247,8 @@ class CCustomKernel: public CKernel
}

dummy_init(rows, cols);
// temporary bugfix, TODO with free_matrix
full_kernel_matrix.destroy_matrix();

full_kernel_matrix.free_matrix();
return true;
}

Expand Down

0 comments on commit 0ef3680

Please sign in to comment.