N
Nick
I've seen a lot of posts on this problem, but none seems to help.
Here is the code:
/code
file = open(prefix1)
text = file.readlines()
len = len(text)
fields = text[1].split()
num_rows = int(fields[1])
num_cols = int(fields[2])
U1_matrix = []
print fields
print repr(fields)
print len(fields)
for line in text[2: num_rows+2]:
fields = line.split()
# print "fields", fields, line
for i in range(len(fields)):
fields = float(fields)
U1_matrix.append(fields)
/*code
prefix is a space/line delimited ascii file that represents a 2D
matrix. i'm trying to read in 2 matrices from different files, strip
away the header stuff and then take the dot product of the 2
matrices. any help is much appreciated.
thanks,
nick
Here is the code:
/code
file = open(prefix1)
text = file.readlines()
len = len(text)
fields = text[1].split()
num_rows = int(fields[1])
num_cols = int(fields[2])
U1_matrix = []
print fields
print repr(fields)
print len(fields)
for line in text[2: num_rows+2]:
fields = line.split()
# print "fields", fields, line
for i in range(len(fields)):
fields = float(fields)
U1_matrix.append(fields)
/*code
prefix is a space/line delimited ascii file that represents a 2D
matrix. i'm trying to read in 2 matrices from different files, strip
away the header stuff and then take the dot product of the 2
matrices. any help is much appreciated.
thanks,
nick