# -*- coding: utf-8 -*-
"""
Created on Tue May 14 15:37:59 2019
@author: Ai酱
"""
class Mattrix:
val = []
shape=(0,)
def __init__(self,val):
if type(val)==list:
self.val = val
if type(val)==Mattrix:
self.val = val.val
self.update_shape()
def __str__(self):
return str(self.val)
def __repr__(self):
return self.__str__()
def update_shape(self):
'''
更新矩阵的形状属性值
'''
self.shape=(len(self.val),)
if len(self.val)>0 and type(self.val[0])==list:
self.shape += (len(self.val[0]),)
def size(s
Python从0开始实现Numpy矩阵库,拒绝掉包侠,学习造轮子
最新推荐文章于 2022-05-01 20:53:14 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)