本文整理汇总了Python中LinearAlgebra.solve_linear_equations方法的典型用法代码示例。如果您正苦于以下问题:Python LinearAlgebra.solve_linear_equations方法的具体用法?Python LinearAlgebra.solve_linear_equations怎么用?Python LinearAlgebra.solve_linear_equations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinearAlgebra
的用法示例。
在下文中一共展示了LinearAlgebra.solve_linear_equations方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fit_polynomial
# 需要导入模块: import LinearAlgebra [as 别名]
# 或者: from LinearAlgebra import solve_linear_equations [as 别名]
def fit_polynomial(x_vector, data_vector):
"""Fit a polynomial of degree `degree' at the points
in `x_vector' to the `data_vector' by interpolation.
"""
import Numeric as num
import LinearAlgebra as la
degree = len(x_vector)-1
vdm = vandermonde(x_vector, degree)
result = la.solve_linear_equations(vdm, num.array(data_vector))
result = list(result)
result.reverse()
return Polynomial(result)
示例2: main
# 需要导入模块: import LinearAlgebra [as 别名]
# 或者: from LinearAlgebra import solve_linear_equations [as 别名]
def main():
import Numeric,LinearAlgebra
import sys
sys.path.append('/home/people/tc/svn/tc_sandbox/misc/rmsf_nmr.py')
import rmsf_nmr
pdb = '1e8l'
chain = 'A'
model1 = 1
model2 = 2
d_coordinates = rmsf_nmr.parse_coordinates(pdb,chain,)
vector_difference = calculate_difference_vector(d_coordinates,model1,model2,)
l_coordinates = d_coordinates[1]
matrix_hessian = rmsf_nmr.calculate_hessian_matrix(l_coordinates)
l_eigenvectors = rmsf_nmr.calculate_eigenvectors(matrix_hessian)
l_eigenvectors_transposed = transpose_rows_and_columns(l_eigenvectors)
vector_difference = Numeric.array(vector_difference)
l_contributions = LinearAlgebra.solve_linear_equations(l_eigenvectors_transposed,vector_difference)
fd = open('contrib_%s_%s.tmp' %(model1,model2),'w')
fd.close()
for i in range(len(l_contributions)):
## print i, vector[i]
fd = open('contrib_%s_%s.tmp' %(model1,model2),'a')
fd.write('%s %s\n' %(i+1,l_contributions[i]))
fd.close()
fo = 'cumoverlap_%s_%s.tmp' %(model1,model2)
mode_min = 6
calculate_cumulated_overlap(fo,l_contributions,vector_difference,l_eigenvectors,mode_min)
return
示例3: str
# 需要导入模块: import LinearAlgebra [as 别名]
# 或者: from LinearAlgebra import solve_linear_equations [as 别名]
w_matrix_list.append(w_matrix_row)
dbg_file.write('\nW Matrix List\n')
dbg_file.write( str(w_matrix_list) )
w_matrix = Numeric.array(w_matrix_list)
dbg_file.write('\nW Matrix\n')
dbg_file.write( str(w_matrix) )
q_list = []
#for q in offset_table.values():
# q_list.append(list(q))
for k in keys_in_order:
q_list.append( list(k) )
dbg_file.write('\nQ List\n')
dbg_file.write( str(q_list) )
q_vector = Numeric.array(q_list)
print 'Solving for alpha vector...'
alpha_vector = LinearAlgebra.solve_linear_equations(w_matrix, q_vector)
dbg_file.write('\nAlpha Vector\n')
dbg_file.write( str(alpha_vector) )
print 'Alpha Vector found.'
out_file = ''
if argc == '2':
out_file = sys.argv[1]
else:
out_file = sys.argv[2]
in_file.close()
out_file = file(out_file, 'w')
alpha_vector_list = alpha_vector.tolist()
dbg_file.write('\nCheck Solution\n')
solution_check = Numeric.matrixmultiply(w_matrix, alpha_vector)
dbg_file.write( str(solution_check) )