numpy 数组和矩阵之间有什么区别?我应该使用哪一种? [英] What are the differences between numpy arrays and matrices? Which one should I use?

查看:24
本文介绍了numpy 数组和矩阵之间有什么区别?我应该使用哪一种?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

各自的优缺点是什么?

据我所知,如果需要,任何一个都可以替代另一个,那么我应该费心使用两者还是只坚持其中一个?

From what I've seen, either one can work as a replacement for the other if need be, so should I bother using both or should I stick to just one of them?

节目的风格会影响我的选择吗?我正在使用 numpy 进行一些机器学习,所以确实有很多矩阵,但也有很多向量(数组).

Will the style of the program influence my choice? I am doing some machine learning using numpy, so there are indeed lots of matrices, but also lots of vectors (arrays).

推荐答案

根据官方文档,现在不建议使用矩阵类,因为将来会删除它.

As per the official documents, it's not anymore advisable to use matrix class since it will be removed in the future.

https://numpy.org/doc/stable/reference/生成/numpy.matrix.html

正如其他答案已经指出的那样,您可以使用 NumPy 数组实现所有操作.

As other answers already state that you can achieve all the operations with NumPy arrays.

这篇关于numpy 数组和矩阵之间有什么区别?我应该使用哪一种?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆