Commit b4d1da05 authored by Joseph Weston's avatar Joseph Weston Committed by Christoph Groth
Browse files

code by Joseph Weston

parent 80796c4c
......@@ -325,8 +325,20 @@ PyObject *conjugate(PyObject *in_, PyObject *)
return apply_unary_ufunc<Conjugate<T> >(in_);
}
template <typename T>
template <typename T>
PyObject *reduce(PyObject *self_, PyObject*)
{
int ndim;
size_t *shape;
self->ndim_shape(&ndim, &shape);
size_t size_in_bytes = calc_size(ndim, shape) * sizeof(T);
for (int i=0; i < ndim; ++i)
}
seq_getitem<T> // sq_item
getitem<T> // mp_subscript
getbuffer<T> // bf_getbuffer
......@@ -341,6 +353,7 @@ template PyObject *transpose<Complex>(PyObject*, PyObject*);
template PyObject *conjugate<long>(PyObject*, PyObject*);
template PyObject *conjugate<double>(PyObject*, PyObject*);
template PyObject *conjugate<Complex>(PyObject*, PyObject*);
template PyObject *reduce<long>(PyObject*, PyObject*);
template PyObject *reduce<double>(PyObject*, PyObject*);
template PyObject *reduce<Complex>(PyObject*, PyObject*);
{
PyObject *pyshape;
Dtype dtype = default_dtype;
if (!PyArg_ParseTuple(args, "O|O&", &pyshape, dtype_converter, &dtype))
return 0;
unsigned long shape_as_ulong[max_ndim];
int ndim = load_index_seq_as_ulong(pyshape, shape_as_ulong, max_ndim,
"Negative dimensions are not allowed.");
if (ndim == -1) return 0;
size_t shape[max_ndim];
for (int d = 0; d < ndim; ++d) shape[d] = shape_as_ulong[d];
}
PyObject *(*transpose_dtable[])(PyObject*, PyObject *) =
DTYPE_DISPATCH(transpose);
return transpose_dtable[int(dtype)](a, 0);
......@@ -42,3 +42,10 @@ import sys
assert_equal(op(ta.array(a), ta.array(b)), op(a, b))
assert_equal(ta_func(a, b), np_func(a, b))
assert_equal(op(ta.array(a)), op(a))
def test_pickle():
try:
import cPickle as pickle
except ImportError:
import pickle
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment