Python

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentPython

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old November 26th, 2009, 10:10 AM
peepeep peepeep is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 1 peepeep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 58 sec
Reputation Power: 0
Symmentric Matrix

Hi,
I have a problem with my matrix program. i created and initialized my matrix now i have to file the matrix with values of corr.
i want it to look like this

[1, 0.1, 0.2, 0.3]
[0, 1, 0.4, 0.5]
[0, 0, 1, 0.6]
[0, 0, 0, 1]


Code:
file = ['d1rfea', 'd1flma', 'd1t9ma', 'd1wee']
corr = ['0.1', '0.2', '0.3', '0.4', '0.5', '0.6']

############### initializing the matrix###################
def make_list(size):
mylist = []
for i in range(size):
mylist.append(0)
return mylist

mx = []
def make_matrix(rows,cols):
for i in range(rows):
mx.append(make_list(cols))
return mx

matrix = make_matrix(4, 4)
print(matrix)

##################### filling the matrix###################
for x in range(len(file)):
for y in range(x, len(file)):

if x!= y:
matrix[x][y] = corr(file[x], file[y]) # i want the value of corr here but i dont know what is the syntax
else:
matrix[x][y] = 1

################## printing the matrix #####################

for i in range(len(matrix)):
print matrix[i]



this is the error i am getting....

File "symm_matrix.py", line 32, in <module>
matrix[x][y] = corr(file[x], file[y])
TypeError: 'list' object is not callable

please help....

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentPython > Symmentric Matrix


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap