Thanks Warren, this is great, and even handles giant arrays just fine if you've
got enough RAM.
I also just found this StackOverflow post with another solution.
a.repeat(2, axis=0).repeat(2, axis=1).
http://stackoverflow.com/questions/7525214/how-to-scale-a-numpy-array
np.kron lets you do
You can also use numpy.tile
-=- Olivier
2011/12/3 Robin Kraft rkra...@gmail.com
Thanks Warren, this is great, and even handles giant arrays just fine if
you've got enough RAM.
I also just found this StackOverflow post with another solution.
a.repeat(2, axis=0).repeat(2, axis=1).
That does repeat the elements, but doesn't get them into the desired order.
In [4]: print a
[[1 2]
[3 4]]
In [7]: np.tile(a, 4)
Out[7]:
array([[1, 2, 1, 2, 1, 2, 1, 2],
[3, 4, 3, 4, 3, 4, 3, 4]])
In [8]: np.tile(a, 4).reshape(4,4)
Out[8]:
array([[1, 2, 1, 2],
[1, 2, 1, 2],
Ah sorry, I hadn't read carefully enough what you were trying to achieve. I
think the double repeat solution looks like your best option then.
-=- Olivier
2011/12/3 Robin Kraft rkra...@gmail.com
That does repeat the elements, but doesn't get them into the desired order.
In [4]: print a
[[1
On 03.12.2011, at 6:22PM, Robin Kraft wrote:
That does repeat the elements, but doesn't get them into the desired order.
In [4]: print a
[[1 2]
[3 4]]
In [7]: np.tile(a, 4)
Out[7]:
array([[1, 2, 1, 2, 1, 2, 1, 2],
[3, 4, 3, 4, 3, 4, 3, 4]])
In [8]: np.tile(a,
On 03.12.2011, at 6:47PM, Olivier Delalleau wrote:
Ah sorry, I hadn't read carefully enough what you were trying to achieve. I
think the double repeat solution looks like your best option then.
Considering that it is a lot shorter than fixing the tile() result, you
are probably right (I've
Ha! I knew it had to be possible! Thanks Derek. So for and N = 2 (now on my
laptop):
In [70]: M = 1200
In [69]: N = 2
In [71]: a = np.random.randint(0, 255, (M**2)).reshape(M,-1)
In [76]: timeit np.rollaxis(np.tile(a, N**2).reshape(M,N,-1), 2,
1).reshape(M*N,-1)
10 loops, best of 3: 99.1 ms
When attempting to cast to a user defined type, PyArray_GetCast looks
up the cast function in the dictionary but doesn't check if the entry
exists. This causes segfaults. Here's a patch.
Geoffrey
diff --git a/numpy/core/src/multiarray/convert_datatype.c
Hi everyone,
There have been some wonderfully vigorous discussions over the past few months
that have made it clear that we need some clarity about how decisions will be
made in the NumPy community.
When we were a smaller bunch of people it seemed easier to come to an agreement
and
Hello,
I'm trying to add a fixed precision rational number dtype to numpy,
and am running into an issue trying to register ufunc loops. The code
in question looks like
int npy_rational = PyArray_RegisterDataType(rational_descr);
PyObject* equal = ... // extract equal object from the
Hi Travis,
On Sat, Dec 3, 2011 at 6:18 PM, Travis Oliphant teoliph...@gmail.com wrote:
Hi everyone,
There have been some wonderfully vigorous discussions over the past few
months that have made it clear that we need some clarity about how decisions
will be made in the NumPy community.
I like the idea of trying to reach consensus first. The only point of
having a board is to have someway to resolve issues should consensus not be
reachable. Believe me, I'm not that excited about a separate mailing list.
It would be great if we could resolve everything on a single
In numpy 1.6.1, what's the most straightforward way to convert a datetime64
to a python datetime.datetime? E.g. I have
In [1]: d = datetime64(2011-12-03 12:34:56.75)
In [2]: d
Out[2]: 2011-12-03 12:34:56.75
I want the same time as a datetime.datetime instance. My best hack so far
is to
On Sat, Dec 3, 2011 at 7:18 PM, Travis Oliphant teoliph...@gmail.comwrote:
Hi everyone,
There have been some wonderfully vigorous discussions over the past few
months that have made it clear that we need some clarity about how
decisions will be made in the NumPy community.
When we were a
14 matches
Mail list logo