當前位置: 首頁>>代碼示例>>Python>>正文


Python LinearAlgebra.solve_linear_equations方法代碼示例

本文整理匯總了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)
開發者ID:YHUCD,項目名稱:NEKCEM,代碼行數:17,代碼來源:spline.py

示例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
開發者ID:tommycarstensen,項目名稱:sandbox,代碼行數:41,代碼來源:cumulative_overlap.py

示例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) )
開發者ID:Michael-Lfx,項目名稱:vrjuggler,代碼行數:32,代碼來源:matrix_solver.py


注:本文中的LinearAlgebra.solve_linear_equations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。