473,395 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Numpy/Scipy set field of matrix?

cnb
, 'argmax', 'argmin', 'argsort', 'astype', 'base', 'byteswap',
'choose', 'clip', 'compress', 'conj', 'conjugate', 'copy', 'ctypes',
'cumprod', 'cumsum', 'data', 'diagonal', 'dtype', 'dump', 'dumps',
'fill', 'flags', 'flat', 'flatten', 'getA', 'getA1', 'getH', 'getI',
'getT', 'getfield', 'imag', 'item', 'itemset', 'itemsize', 'max',
'mean', 'min', 'nbytes', 'ndim', 'newbyteorder', 'nonzero', 'prod',
'ptp', 'put', 'ravel', 'real', 'repeat', 'reshape', 'resize', 'round',
'searchsorted', 'setfield', 'setflags', 'shape', 'size', 'sort',
'squeeze', 'std', 'strides', 'sum', 'swapaxes', 'take', 'tofile',
'tolist', 'tostring', 'trace', 'transpose', 'var', 'view']
>>m
matrix([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])

how do I set the field 1,2 (=6) to 45 for example?
and how do I initialize a matrix and then add values in a for-loop?

Im using PIL and want to store all the pixels of an image in a matrix.

But I can't find the appropriate operations.
Sep 2 '08 #1
1 1602
On Tue, 02 Sep 2008 13:27:06 -0700, cnb wrote:
>>>m
matrix([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])

how do I set the field 1,2 (=6) to 45 for example?
and how do I initialize a matrix and then add values in a for-loop?

Im using PIL and want to store all the pixels of an image in a matrix.

But I can't find the appropriate operations.
Work through the tutorial in the Python documentation and read some
introduction to Numpy.

Ciao,
Marc 'BlackJack' Rintsch
Sep 2 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jason | last post by:
Hello: I am using the following versions of Python and packages on Windows XP (SP2): Python 2.4.2 NumPy 0.9.4.win32-py2.4 SciPy 0.4.4 for Python 2.4 and Pentium 4/SSE2 In the Python...
3
by: Iljya | last post by:
Hello, I need to pickle the type numpy.float32 but encounter an error when I try to do so. I am able to pickle the array itself, it is specifically the type that I cannot pickle. I am using:...
15
by: greg.landrum | last post by:
After using numeric for almost ten years, I decided to attempt to switch a large codebase (python and C++) to using numpy. Here's are some comments about how that went. - The code to...
2
by: robert | last post by:
I'm using latest numpy & scipy. What is this problem ? : RuntimeError: module compiled against version 1000002 of C-API but this version of numpy is 1000009 Traceback (most recent call last):...
18
by: robert | last post by:
Is there a ready made function in numpy/scipy to compute the correlation y=mx+o of an X and Y fast: m, m-err, o, o-err, r-coef,r-coef-err ? Or a formula to to compute the 3 error ranges? ...
1
by: Jianzhong Liu | last post by:
Hello, Guys, I have a question about the linear_least_squares in Numpy. My linear_least_squares cannot give me the results. I use Numpy1.0. The newest version. So I checked online and get...
5
by: auditory | last post by:
I am a newbie here I am trying to read "space separated floating point data" from file I read about csv module by searching this group, but I couldn't read space separated values with csv....
1
by: Michael O'Brien | last post by:
Hola~ I have a large array of points (over a million). I would like to multiply each point in the array by a 4x4 matrix. I keep thinking there should be an easy way to do this using numpy, but I...
2
by: Daniel Nogradi | last post by:
I'm just getting started with numpy/scipy and first would like to get a view of what it can do and what it can't. The main idea is to move from maple to python and the first thing that poped up is...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.