博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
一个使用numpy.ones()的矩阵| 使用Python的线性代数
阅读量:2538 次
发布时间:2019-05-11

本文共 1390 字,大约阅读时间需要 4 分钟。

Ones Matrix - When all the entries of a matrix are one, then it is called as ones matrix. It may be of any dimension (MxN).

一个矩阵 -当矩阵的所有条目均为1时,则称为一个矩阵。 它可以是任何尺寸( MxN )。

Properties:

特性:

  • The determinant of the matrix is 1 (when the number of columns and rows are 1, i.e. there is only one element in the matrix) or 0 otherwise.

    矩阵的行列式为1(当行数为1时,即矩阵中只有一个元素),否则为0。

  • The Rank of any Ones Matrix is 1.

    任何人矩阵的等级是1。

In python, we have an inbuilt function (defined in numpy library) numpy.ones() to define the ones matrix. Here is the code with examples.

在python中,我们有一个内置函数(在numpy库中定义) numpy.ones()来定义一个矩阵。 这是带有示例的代码。

使用numpy.ones()实现矩阵矩阵的Python代码 (Python code for ones matrix using numpy.ones())

# Linear Algebra Learning Sequence# Ones matrix using numpy.ones() import numpy as npa = np.ones([3,5])b = np.ones([6,6])c = np.ones([9,5])#printing the matricesprint("\n----Ones Matrix (3x5)----\n",a)print("\n----Ones Matrix (6x6)----\n",b)print("\n----Ones Matrix (9x5)----\n",c)

Output:

输出:

----Ones Matrix (3x5)---- [[1. 1. 1. 1. 1.] [1. 1. 1. 1. 1.] [1. 1. 1. 1. 1.]]----Ones Matrix (6x6)---- [[1. 1. 1. 1. 1. 1.] [1. 1. 1. 1. 1. 1.] [1. 1. 1. 1. 1. 1.] [1. 1. 1. 1. 1. 1.] [1. 1. 1. 1. 1. 1.] [1. 1. 1. 1. 1. 1.]]----Ones Matrix (9x5)---- [[1. 1. 1. 1. 1.] [1. 1. 1. 1. 1.] [1. 1. 1. 1. 1.] [1. 1. 1. 1. 1.] [1. 1. 1. 1. 1.] [1. 1. 1. 1. 1.] [1. 1. 1. 1. 1.] [1. 1. 1. 1. 1.] [1. 1. 1. 1. 1.]]

翻译自:

转载地址:http://gnxzd.baihongyu.com/

你可能感兴趣的文章
Coursera--Neural Networks and Deep Learning Week 2
查看>>
C#中的委托和事件(续)【来自张子扬】
查看>>
机器学习部分国内牛人
查看>>
模拟Sping MVC
查看>>
Luogu 3261 [JLOI2015]城池攻占
查看>>
java修饰符
查看>>
C# Using 用法
查看>>
javascript函数的几种写法集合
查看>>
BZOJ第1页养成计划
查看>>
漫漫修行路
查看>>
js与jQuery的区别——每日一记录
查看>>
MyBatis 处理sql中的 大于,小于,大于等于,小于等于
查看>>
Lunix文件的读写权限问题
查看>>
Liferay 7:portlet name
查看>>
PostgreSQL9.6.3的REDIS测试
查看>>
解决pycharm问题:module 'pip' has no attribute 'main'
查看>>
002 lambda表达式
查看>>
springboot添加自定义注解
查看>>
POJ 2391 Ombrophobic Bovines ( 经典最大流 && Floyd && 二分 && 拆点建图)
查看>>
JavaScript数组方法之reduce
查看>>