mirror of
https://github.com/apachecn/ailearning.git
synced 2026-05-04 12:14:57 +08:00
2020-10-19 21:08:55
This commit is contained in:
@@ -82,7 +82,7 @@
|
||||
|
||||
In [1]:
|
||||
|
||||
```
|
||||
```py
|
||||
import numpy
|
||||
import numpy.matlib
|
||||
|
||||
@@ -90,7 +90,7 @@ import numpy.matlib
|
||||
|
||||
In [2]:
|
||||
|
||||
```
|
||||
```py
|
||||
a = numpy.ones(7)
|
||||
|
||||
print a.shape
|
||||
@@ -98,7 +98,7 @@ print type(a)
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
```py
|
||||
(7L,)
|
||||
<type 'numpy.ndarray'>
|
||||
|
||||
@@ -106,7 +106,7 @@ print type(a)
|
||||
|
||||
In [3]:
|
||||
|
||||
```
|
||||
```py
|
||||
a = numpy.matlib.ones(7)
|
||||
|
||||
print a.shape
|
||||
@@ -114,7 +114,7 @@ print type(a)
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
```py
|
||||
(1L, 7L)
|
||||
<class 'numpy.matrixlib.defmatrix.matrix'>
|
||||
|
||||
@@ -124,7 +124,7 @@ print type(a)
|
||||
|
||||
In [4]:
|
||||
|
||||
```
|
||||
```py
|
||||
a = numpy.array([1,2,3])
|
||||
|
||||
b = numpy.mat(a)
|
||||
@@ -133,7 +133,7 @@ print type(b)
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
```py
|
||||
<class 'numpy.matrixlib.defmatrix.matrix'>
|
||||
|
||||
```
|
||||
@@ -142,13 +142,13 @@ print type(b)
|
||||
|
||||
In [5]:
|
||||
|
||||
```
|
||||
```py
|
||||
a = numpy.random.rand(10)
|
||||
print a
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
```py
|
||||
[ 0.66007267 0.34794294 0.5040946 0.65044648 0.74763248 0.42486999
|
||||
0.90922612 0.69071747 0.33541076 0.08570178]
|
||||
|
||||
@@ -160,7 +160,7 @@ print a
|
||||
|
||||
In [6]:
|
||||
|
||||
```
|
||||
```py
|
||||
from numpy import *
|
||||
import scipy.linalg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user