Python求矩阵的秩 numpy.linalg.matrix_rank

#!/bin/python3
#-*- coding: utf-8 -*-
import numpy as np

def p(x): print(x)

x = np.array([[1,2,1],[0,0,0], [-1,-2,-1]])
p(x)

r = np.linalg.matrix_rank(x)
p(r)

x1 = np.array([1, 0, -1])
y1 = np.array([1,2,1])
x1.shape = (1, 3)
y1.shape = (1, 3)

# x1 = np.transpose(x1)
# p(np.dot(x1, y1))

y1 = np.transpose(y1)

p(y1)
p(y1.dot(x1))


发表于:2014-10-12 16:21:06

原文链接(转载请保留): http://www.multisilicon.com/blog/a24332947.html

友情链接: MICROIC
首页