RE: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-19 Thread Prasad, Ramit
Redirecting to his question to the list.
I need of a matrix, not of an array.
But is this error due to a numpy bug?

I am not an expert on NumPy/SciPy, but I do not believe matrixes are allowed to 
be 3 dimensional. Google only produced results of 3 dimensional arrays.


Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423



This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-14 Thread Paolo Zaffino
Nobody can help me?



2011/10/12 Paolo Zaffino zaffin...@gmail.com

 I wrote a function thaht works on a 3D matrix.
 As first thing I have an array and I want reshape it into a 3D matrix (for
 further manipulations).
 For this reason I wrote in a row:

 matrix=matrix.reshape(a, b, c).T

 It work fine on GNU/Linux and Mac OS but not on Windows.
 In Windows I get this error:

 matrix=matrix.reshape(a, b, c).T

 ValueError: total size of new array must be unchanged

 Thank you.




 2011/10/11 David Robinow drobi...@gmail.com

 2011/10/11 Paolo Zaffino zaffin...@gmail.com:
  Nobody can help me?
  Nope, not unless you post some code. Your problem description is too
 vague.



-- 
http://mail.python.org/mailman/listinfo/python-list


RE: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-14 Thread Prasad, Ramit
From: python-list-bounces+ramit.prasad=jpmorgan@python.org 
[mailto:python-list-bounces+ramit.prasad=jpmorgan@python.org] On Behalf Of 
Paolo Zaffino
Sent: Friday, October 14, 2011 3:55 PM
To: python-list@python.org
Subject: Re: [NUMPY] ValueError: total size of new array must be unchanged 
just on Windows

Nobody can help me?


2011/10/12 Paolo Zaffino zaffin...@gmail.com
I wrote a function thaht works on a 3D matrix.
As first thing I have an array and I want reshape it into a 3D matrix (for 
further manipulations).
For this reason I wrote in a row:

matrix=matrix.reshape(a, b, c).T

It work fine on GNU/Linux and Mac OS but not on Windows.
In Windows I get this error:

matrix=matrix.reshape(a, b, c).T

ValueError: total size of new array must be unchanged
Thank you.



2011/10/11 David Robinow drobi...@gmail.com
2011/10/11 Paolo Zaffino zaffin...@gmail.com:
 Nobody can help me?
 Nope, not unless you post some code. Your problem description is too vague.
==

You can do this by converting to an array.

 mat = numpy.matrix( [[1,2,],[3,4],[5,6],[7,8]] )
 numpy.array( mat )
array([[1, 2],
   [3, 4],
   [5, 6],
   [7, 8]])
 a = _
 numpy.reshape( a, (2,2,2))
array([[[1, 2],
[3, 4]],

   [[5, 6],
[7, 8]]])


Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423



This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-14 Thread MRAB

On 14/10/2011 21:55, Paolo Zaffino wrote:

Nobody can help me?


Others have already tried to help you.

What is the shape and size of 'matrix' before, and what are the values
of 'a', 'b' and 'c'?

Print them in the ones which work (GNU/Linux and Mac OS) and the one
which doesn't (Windows). Do they print the same values?

Do not assume that they are the same. Print them to make sure.


2011/10/12 Paolo Zaffino zaffin...@gmail.com mailto:zaffin...@gmail.com

I wrote a function thaht works on a 3D matrix.
As first thing I have an array and I want reshape it into a 3D
matrix (for further manipulations).
For this reason I wrote in a row:

matrix=matrix.reshape(a, b, c).T

It work fine on GNU/Linux and Mac OS but not on Windows.
In Windows I get this error:

matrix=matrix.reshape(a, b, c).T

ValueError: total size of new array must be unchanged

Thank you.

2011/10/11 David Robinow drobi...@gmail.com
mailto:drobi...@gmail.com

2011/10/11 Paolo Zaffino zaffin...@gmail.com
mailto:zaffin...@gmail.com:
  Nobody can help me?
  Nope, not unless you post some code. Your problem description
is too vague.


--
http://mail.python.org/mailman/listinfo/python-list


Re: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-12 Thread Paolo Zaffino
I wrote a function thaht works on a 3D matrix.
As first thing I have an array and I want reshape it into a 3D matrix (for
further manipulations).
For this reason I wrote in a row:

matrix=matrix.reshape(a, b, c).T

It work fine on GNU/Linux and Mac OS but not on Windows.
In Windows I get this error:

matrix=matrix.reshape(a, b, c).T

ValueError: total size of new array must be unchanged

Thank you.



2011/10/11 David Robinow drobi...@gmail.com

 2011/10/11 Paolo Zaffino zaffin...@gmail.com:
  Nobody can help me?
  Nope, not unless you post some code. Your problem description is too
 vague.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-11 Thread Paolo Zaffino
Nobody can help me?




2011/10/10 Paolo Zaffino zaffin...@gmail.com

 On Mac OS there is numpy 1.2.1, on Fedora 14 64bits numpy 1.4.1 and on
 Ubuntu 10.04 64bits numpy 1.3.0.
 On these platforms my function runs without problems.
 Just on Windows it doesn't works.



 2011/10/9 Yaşar Arabacı yasar11...@gmail.com

 I don't know about your problem, but did you compare numpy versions in
 windows and other platforms? You may have newer/older version in Windows.
 Otherwise, it looks like a platform spesific bug to me.

 2011/10/9 Paolo Zaffino zaffin...@gmail.com

  Hello,
 I wrote a function that works on a numpy matrix and it works fine on
 Mac OS and GNU/Linux (I didn't test it on python 3)
 Now I have a problem with numpy: the same python file doesn't work on
 Windows (Windows xp, python 2.7 and numpy 2.6.1).
 I get this error:

 matrix=matrix.reshape(a, b, c)
 ValueError: total size of new array must be unchanged

 Why? Do anyone have an idea about this?
 Thank you very much.
 --
 http://mail.python.org/mailman/listinfo/python-list




 --
 http://yasar.serveblog.net/



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-11 Thread David Robinow
2011/10/11 Paolo Zaffino zaffin...@gmail.com:
 Nobody can help me?
 Nope, not unless you post some code. Your problem description is too vague.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-11 Thread Peter Otten
Paolo Zaffino wrote:

 Nobody can help me?

Add the lines

print a=%r, b=%r, c=%r % (a, b, c)
print type=%s, shape=%r, size=%r % (type(matrix), matrix.shape, 
matrix.size)

before this one

 matrix = matrix.reshape(a, b, c)

and tell us what it prints both on a system where it works and where it 
doesn't.

If a, b, and c are all integers and 

a * b * c == matrix.size

try passing a tuple:

matrix = matrix.reshape((a, b, c)) # note the double parens


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-10 Thread Paolo Zaffino
On Mac OS there is numpy 1.2.1, on Fedora 14 64bits numpy 1.4.1 and on
Ubuntu 10.04 64bits numpy 1.3.0.
On these platforms my function runs without problems.
Just on Windows it doesn't works.


2011/10/9 Yaşar Arabacı yasar11...@gmail.com

 I don't know about your problem, but did you compare numpy versions in
 windows and other platforms? You may have newer/older version in Windows.
 Otherwise, it looks like a platform spesific bug to me.

 2011/10/9 Paolo Zaffino zaffin...@gmail.com

 Hello,
 I wrote a function that works on a numpy matrix and it works fine on
 Mac OS and GNU/Linux (I didn't test it on python 3)
 Now I have a problem with numpy: the same python file doesn't work on
 Windows (Windows xp, python 2.7 and numpy 2.6.1).
 I get this error:

 matrix=matrix.reshape(a, b, c)
 ValueError: total size of new array must be unchanged

 Why? Do anyone have an idea about this?
 Thank you very much.
 --
 http://mail.python.org/mailman/listinfo/python-list




 --
 http://yasar.serveblog.net/


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-09 Thread Yaşar Arabacı
I don't know about your problem, but did you compare numpy versions in
windows and other platforms? You may have newer/older version in Windows.
Otherwise, it looks like a platform spesific bug to me.

2011/10/9 Paolo Zaffino zaffin...@gmail.com

 Hello,
 I wrote a function that works on a numpy matrix and it works fine on
 Mac OS and GNU/Linux (I didn't test it on python 3)
 Now I have a problem with numpy: the same python file doesn't work on
 Windows (Windows xp, python 2.7 and numpy 2.6.1).
 I get this error:

 matrix=matrix.reshape(a, b, c)
 ValueError: total size of new array must be unchanged

 Why? Do anyone have an idea about this?
 Thank you very much.
 --
 http://mail.python.org/mailman/listinfo/python-list




-- 
http://yasar.serveblog.net/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-09 Thread Steven D'Aprano
Paolo Zaffino wrote:

 Hello,
 I wrote a function that works on a numpy matrix and it works fine on
 Mac OS and GNU/Linux (I didn't test it on python 3)
 Now I have a problem with numpy: the same python file doesn't work on
 Windows (Windows xp, python 2.7 and numpy 2.6.1).
 I get this error:
 
 matrix=matrix.reshape(a, b, c)
 ValueError: total size of new array must be unchanged
 
 Why? Do anyone have an idea about this?
 Thank you very much.

Please give sample values for matrix, a, b and c that demonstrate the issue.

What version of Python and numpy are you using on Mac and Linux?



-- 
Steven

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [NUMPY] ValueError: total size of new array must be unchanged just on Windows

2011-10-09 Thread Nobody
On Sun, 09 Oct 2011 13:59:11 -0700, Paolo Zaffino wrote:

 I wrote a function that works on a numpy matrix and it works fine on
 Mac OS and GNU/Linux (I didn't test it on python 3)
 Now I have a problem with numpy: the same python file doesn't work on
 Windows (Windows xp, python 2.7 and numpy 2.6.1).
 I get this error:
 
 matrix=matrix.reshape(a, b, c)
 ValueError: total size of new array must be unchanged
 
 Why?

What it says. The reshape()d array must have the same total number of
elements as the original array.

If it works on one platform and not on another, that indicates that either
matrix has a different shape on different platforms, or a*b*c is
different on different platforms.

As no-one here (except you) has any idea how matrix, a, b and c are
getting their values, it's impossible for us to say why they're getting
different values on different platforms.

-- 
http://mail.python.org/mailman/listinfo/python-list