zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
U
P±d$|ã@s´ddddgZddlZddlZddlZddlmmZddlmZm    Z    ddl
m Z ddl m Z d    d
„Ze d ƒdd d„ƒZe d ƒGd d„dejƒƒZdd„Ze d ƒddd„ƒZeZdS)ÚmatrixÚbmatÚmatÚasmatrixéN)Ú concatenateÚisscalar)Ú
set_module©Ú matrix_powerc Cs dD]}| |d¡}q| d¡}g}d}|D]n}| d¡}g}|D]}| ¡}    | ttj|    ƒ¡qB|dkrtt|ƒ}
nt|ƒ|
krˆtdƒ‚|d7}| |¡q,|S)Nz[]Úú;rú,zRows not the same size.é)    ÚreplaceÚsplitÚextendÚmapÚastÚ literal_evalÚlenÚ
ValueErrorÚappend) ÚdataÚcharÚrowsÚnewdataÚcountÚrowÚtrowÚnewrowÚcolÚtempZNcols©r"úPd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/matrixlib/defmatrix.pyÚ_convert_from_strings$
 
 
  r$ÚnumpycCst||ddS)a@
    Interpret the input as a matrix.
 
    Unlike `matrix`, `asmatrix` does not make a copy if the input is already
    a matrix or an ndarray.  Equivalent to ``matrix(data, copy=False)``.
 
    Parameters
    ----------
    data : array_like
        Input data.
    dtype : data-type
       Data-type of the output matrix.
 
    Returns
    -------
    mat : matrix
        `data` interpreted as a matrix.
 
    Examples
    --------
    >>> x = np.array([[1, 2], [3, 4]])
 
    >>> m = np.asmatrix(x)
 
    >>> x[0,0] = 5
 
    >>> m
    matrix([[5, 2],
            [3, 4]])
 
    F©ÚdtypeÚcopy)r)rr'r"r"r#r$s!c@sfeZdZdZdZdGdd„Zdd„Zd    d
„Zd d „Zd d„Z    dd„Z
dd„Z dd„Z dd„Z dd„Zdd„Zdd„ZdHdd„ZdIdd „ZdJd"d#„ZdKd$d%„ZdLd'd(„ZdMd)d*„ZdNd+d,„ZdOd-d.„ZdPd/d0„ZdQd1d2„ZdRd3d4„ZdSd5d6„ZdTd7d8„ZdUd9d:„Zed;d<„ƒZ ed=d>„ƒZ!ed?d@„ƒZ"dVdAdB„Z#edCdD„ƒZ$edEdF„ƒZ%e$j&Z'e!j&Z(e"j&Z)e%j&Z*e j&Z+dS)WraŽ
    matrix(data, dtype=None, copy=True)
 
    .. note:: It is no longer recommended to use this class, even for linear
              algebra. Instead use regular arrays. The class may be removed
              in the future.
 
    Returns a matrix from an array-like object, or from a string of data.
    A matrix is a specialized 2-D array that retains its 2-D nature
    through operations.  It has certain special operators, such as ``*``
    (matrix multiplication) and ``**`` (matrix power).
 
    Parameters
    ----------
    data : array_like or string
       If `data` is a string, it is interpreted as a matrix with commas
       or spaces separating columns, and semicolons separating rows.
    dtype : data-type
       Data-type of the output matrix.
    copy : bool
       If `data` is already an `ndarray`, then this flag determines
       whether the data is copied (the default), or whether a view is
       constructed.
 
    See Also
    --------
    array
 
    Examples
    --------
    >>> a = np.matrix('1 2; 3 4')
    >>> a
    matrix([[1, 2],
            [3, 4]])
 
    >>> np.matrix([[1, 2], [3, 4]])
    matrix([[1, 2],
            [3, 4]])
 
    g$@NTc CsLtjdtddt|tƒrF|j}|dkr,|}||kr<|s<|S| |¡St|tjƒrš|dkrb|j}n
t |¡}|     |¡}||jkrŠ| |¡S|r–| 
¡S|St|t ƒr¬t |ƒ}tj |||d}|j}|j}    |dkrÚtdƒ‚n"|dkrèd}    n|dkrüd|    df}    d    }
|dkr|jjrd
}
|
s0|jjs0| 
¡}tjj||    |j||
d } | S) NzÙthe matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.é)Ú
stacklevelr&zmatrix must be 2-dimensionalr©rrrÚCÚF)ÚbufferÚorder)ÚwarningsÚwarnÚPendingDeprecationWarningÚ
isinstancerr'ZastypeÚNÚndarrayÚviewr(Ústrr$ÚarrayÚndimÚshaperÚflagsZfortranÚ
contiguousÚ__new__) Úsubtyperr'r(Zdtype2ZintypeÚnewZarrr9r:r/Úretr"r"r#r=ssTû
 
 
 
 
 
 
 
 þzmatrix.__new__cCs¤d|_t|tƒr|jrdS|j}|dkr,dS|dkrttdd„|jDƒƒ}t|ƒ}|dkrb||_dS|dkrztdƒ‚n|j}|dkrŠd|_n|dkr d|df|_dS)    NFr)cSsg|]}|dkr|‘qS)rr")Ú.0Úxr"r"r#Ú
<listcomp>®sz-matrix.__array_finalize__.<locals>.<listcomp>zshape too large to be a matrix.rr+r)Ú_getitemr3rr9Útupler:rr)ÚselfÚobjr9Znewshaper"r"r#Ú__array_finalize__§s(
zmatrix.__array_finalize__cCs¬d|_ztj ||¡}W5d|_Xt|tjƒs2|S|jdkrD|dS|jdkr¨|jd}z t|ƒ}Wntk
r|d}YnX|dkržt    |dƒrž|df|_n
d|f|_|S)NTFrr"r)
rDr4r5Ú __getitem__r3r9r:rÚ    Exceptionr)rFÚindexÚoutÚshÚnr"r"r#rI½s$ 
 
 
 
 
zmatrix.__getitem__cCsDt|tjttfƒr"t |t|ƒ¡St|ƒs4t|dƒs@t ||¡St    S)NÚ__rmul__)
r3r4r5ÚlistrEÚdotrrÚhasattrÚNotImplemented©rFÚotherr"r"r#Ú__mul__×s
 zmatrix.__mul__cCs t ||¡S©N)r4rQrTr"r"r#rOßszmatrix.__rmul__cCs|||dd…<|SrWr"rTr"r"r#Ú__imul__âszmatrix.__imul__cCs
t||ƒSrWr    rTr"r"r#Ú__pow__æszmatrix.__pow__cCs|||dd…<|SrWr"rTr"r"r#Ú__ipow__észmatrix.__ipow__cCstSrW)rSrTr"r"r#Ú__rpow__íszmatrix.__rpow__cCs8|dkr|dS|dkr|S|dkr,| ¡Stdƒ‚dS)z^A convenience function for operations that need to preserve axis
        orientation.
        N©rrrrzunsupported axis)Ú    transposer©rFÚaxisr"r"r#Ú_alignðsz matrix._aligncCs|dkr|dS|SdS)zA convenience function for operations that want to collapse
        to a scalar like _align, but are using keepdims=True
        Nr\r"r^r"r"r#Ú    _collapseýszmatrix._collapsecCs | ¡ ¡S)aÂ
        Return the matrix as a (possibly nested) list.
 
        See `ndarray.tolist` for full documentation.
 
        See Also
        --------
        ndarray.tolist
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3,4))); x
        matrix([[ 0,  1,  2,  3],
                [ 4,  5,  6,  7],
                [ 8,  9, 10, 11]])
        >>> x.tolist()
        [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]
 
        )Ú    __array__Útolist©rFr"r"r#rcsz matrix.tolistcCstjj||||dd |¡S)a 
        Returns the sum of the matrix elements, along the given axis.
 
        Refer to `numpy.sum` for full documentation.
 
        See Also
        --------
        numpy.sum
 
        Notes
        -----
        This is the same as `ndarray.sum`, except that where an `ndarray` would
        be returned, a `matrix` object is returned instead.
 
        Examples
        --------
        >>> x = np.matrix([[1, 2], [4, 3]])
        >>> x.sum()
        10
        >>> x.sum(axis=1)
        matrix([[3],
                [7]])
        >>> x.sum(axis=1, dtype='float')
        matrix([[3.],
                [7.]])
        >>> out = np.zeros((2, 1), dtype='float')
        >>> x.sum(axis=1, dtype='float', out=np.asmatrix(out))
        matrix([[3.],
                [7.]])
 
        T©Zkeepdims)r4r5Úsumra©rFr_r'rLr"r"r#rfs z
matrix.sumcCstjj||dS)aD
        Return a possibly reshaped matrix.
 
        Refer to `numpy.squeeze` for more documentation.
 
        Parameters
        ----------
        axis : None or int or tuple of ints, optional
            Selects a subset of the axes of length one in the shape.
            If an axis is selected with shape entry greater than one,
            an error is raised.
 
        Returns
        -------
        squeezed : matrix
            The matrix, but as a (1, N) matrix if it had shape (N, 1).
 
        See Also
        --------
        numpy.squeeze : related function
 
        Notes
        -----
        If `m` has a single column then that column is returned
        as the single row of a matrix.  Otherwise `m` is returned.
        The returned matrix is always either `m` itself or a view into `m`.
        Supplying an axis keyword argument will not affect the returned matrix
        but it may cause an error to be raised.
 
        Examples
        --------
        >>> c = np.matrix([[1], [2]])
        >>> c
        matrix([[1],
                [2]])
        >>> c.squeeze()
        matrix([[1, 2]])
        >>> r = c.T
        >>> r
        matrix([[1, 2]])
        >>> r.squeeze()
        matrix([[1, 2]])
        >>> m = np.matrix([[1, 2], [3, 4]])
        >>> m.squeeze()
        matrix([[1, 2],
                [3, 4]])
 
        ©r_)r4r5Úsqueezer^r"r"r#riCs1zmatrix.squeezer,cCstjj||dS)aD
        Return a flattened copy of the matrix.
 
        All `N` elements of the matrix are placed into a single row.
 
        Parameters
        ----------
        order : {'C', 'F', 'A', 'K'}, optional
            'C' means to flatten in row-major (C-style) order. 'F' means to
            flatten in column-major (Fortran-style) order. 'A' means to
            flatten in column-major order if `m` is Fortran *contiguous* in
            memory, row-major order otherwise. 'K' means to flatten `m` in
            the order the elements occur in memory. The default is 'C'.
 
        Returns
        -------
        y : matrix
            A copy of the matrix, flattened to a `(1, N)` matrix where `N`
            is the number of elements in the original matrix.
 
        See Also
        --------
        ravel : Return a flattened array.
        flat : A 1-D flat iterator over the matrix.
 
        Examples
        --------
        >>> m = np.matrix([[1,2], [3,4]])
        >>> m.flatten()
        matrix([[1, 2, 3, 4]])
        >>> m.flatten('F')
        matrix([[1, 3, 2, 4]])
 
        ©r/)r4r5Úflatten©rFr/r"r"r#rkxs#zmatrix.flattencCstjj||||dd |¡S)aÜ
        Returns the average of the matrix elements along the given axis.
 
        Refer to `numpy.mean` for full documentation.
 
        See Also
        --------
        numpy.mean
 
        Notes
        -----
        Same as `ndarray.mean` except that, where that returns an `ndarray`,
        this returns a `matrix` object.
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3, 4)))
        >>> x
        matrix([[ 0,  1,  2,  3],
                [ 4,  5,  6,  7],
                [ 8,  9, 10, 11]])
        >>> x.mean()
        5.5
        >>> x.mean(0)
        matrix([[4., 5., 6., 7.]])
        >>> x.mean(1)
        matrix([[ 1.5],
                [ 5.5],
                [ 9.5]])
 
        Tre)r4r5Úmeanrargr"r"r#rms z matrix.meanrcCstjj|||||dd |¡S)aU
        Return the standard deviation of the array elements along the given axis.
 
        Refer to `numpy.std` for full documentation.
 
        See Also
        --------
        numpy.std
 
        Notes
        -----
        This is the same as `ndarray.std`, except that where an `ndarray` would
        be returned, a `matrix` object is returned instead.
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3, 4)))
        >>> x
        matrix([[ 0,  1,  2,  3],
                [ 4,  5,  6,  7],
                [ 8,  9, 10, 11]])
        >>> x.std()
        3.4520525295346629 # may vary
        >>> x.std(0)
        matrix([[ 3.26598632,  3.26598632,  3.26598632,  3.26598632]]) # may vary
        >>> x.std(1)
        matrix([[ 1.11803399],
                [ 1.11803399],
                [ 1.11803399]])
 
        Tre)r4r5Ústdra©rFr_r'rLZddofr"r"r#rn¿s z
matrix.stdcCstjj|||||dd |¡S)a2
        Returns the variance of the matrix elements, along the given axis.
 
        Refer to `numpy.var` for full documentation.
 
        See Also
        --------
        numpy.var
 
        Notes
        -----
        This is the same as `ndarray.var`, except that where an `ndarray` would
        be returned, a `matrix` object is returned instead.
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3, 4)))
        >>> x
        matrix([[ 0,  1,  2,  3],
                [ 4,  5,  6,  7],
                [ 8,  9, 10, 11]])
        >>> x.var()
        11.916666666666666
        >>> x.var(0)
        matrix([[ 10.66666667,  10.66666667,  10.66666667,  10.66666667]]) # may vary
        >>> x.var(1)
        matrix([[1.25],
                [1.25],
                [1.25]])
 
        Tre)r4r5Úvarraror"r"r#rpás z
matrix.varcCstjj||||dd |¡S)aÕ
        Return the product of the array elements over the given axis.
 
        Refer to `prod` for full documentation.
 
        See Also
        --------
        prod, ndarray.prod
 
        Notes
        -----
        Same as `ndarray.prod`, except, where that returns an `ndarray`, this
        returns a `matrix` object instead.
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3,4))); x
        matrix([[ 0,  1,  2,  3],
                [ 4,  5,  6,  7],
                [ 8,  9, 10, 11]])
        >>> x.prod()
        0
        >>> x.prod(0)
        matrix([[  0,  45, 120, 231]])
        >>> x.prod(1)
        matrix([[   0],
                [ 840],
                [7920]])
 
        Tre)r4r5Úprodrargr"r"r#rqsz matrix.prodcCstjj|||dd |¡S)aG
        Test whether any array element along a given axis evaluates to True.
 
        Refer to `numpy.any` for full documentation.
 
        Parameters
        ----------
        axis : int, optional
            Axis along which logical OR is performed
        out : ndarray, optional
            Output to existing array instead of creating new one, must have
            same shape as expected output
 
        Returns
        -------
            any : bool, ndarray
                Returns a single bool if `axis` is ``None``; otherwise,
                returns `ndarray`
 
        Tre)r4r5Úanyra©rFr_rLr"r"r#rr$sz
matrix.anycCstjj|||dd |¡S)aÈ
        Test whether all matrix elements along a given axis evaluate to True.
 
        Parameters
        ----------
        See `numpy.all` for complete descriptions
 
        See Also
        --------
        numpy.all
 
        Notes
        -----
        This is the same as `ndarray.all`, but it returns a `matrix` object.
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3,4))); x
        matrix([[ 0,  1,  2,  3],
                [ 4,  5,  6,  7],
                [ 8,  9, 10, 11]])
        >>> y = x[0]; y
        matrix([[0, 1, 2, 3]])
        >>> (x == y)
        matrix([[ True,  True,  True,  True],
                [False, False, False, False],
                [False, False, False, False]])
        >>> (x == y).all()
        False
        >>> (x == y).all(0)
        matrix([[False, False, False, False]])
        >>> (x == y).all(1)
        matrix([[ True],
                [False],
                [False]])
 
        Tre)r4r5Úallrarsr"r"r#rt;s&z
matrix.allcCstjj|||dd |¡S)aÚ
        Return the maximum value along an axis.
 
        Parameters
        ----------
        See `amax` for complete descriptions
 
        See Also
        --------
        amax, ndarray.max
 
        Notes
        -----
        This is the same as `ndarray.max`, but returns a `matrix` object
        where `ndarray.max` would return an ndarray.
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3,4))); x
        matrix([[ 0,  1,  2,  3],
                [ 4,  5,  6,  7],
                [ 8,  9, 10, 11]])
        >>> x.max()
        11
        >>> x.max(0)
        matrix([[ 8,  9, 10, 11]])
        >>> x.max(1)
        matrix([[ 3],
                [ 7],
                [11]])
 
        Tre)r4r5Úmaxrarsr"r"r#rucs!z
matrix.maxcCstj |||¡ |¡S)aš
        Indexes of the maximum values along an axis.
 
        Return the indexes of the first occurrences of the maximum values
        along the specified axis.  If axis is None, the index is for the
        flattened matrix.
 
        Parameters
        ----------
        See `numpy.argmax` for complete descriptions
 
        See Also
        --------
        numpy.argmax
 
        Notes
        -----
        This is the same as `ndarray.argmax`, but returns a `matrix` object
        where `ndarray.argmax` would return an `ndarray`.
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3,4))); x
        matrix([[ 0,  1,  2,  3],
                [ 4,  5,  6,  7],
                [ 8,  9, 10, 11]])
        >>> x.argmax()
        11
        >>> x.argmax(0)
        matrix([[2, 2, 2, 2]])
        >>> x.argmax(1)
        matrix([[3],
                [3],
                [3]])
 
        )r4r5Úargmaxr`rsr"r"r#rv†s%z matrix.argmaxcCstjj|||dd |¡S)að
        Return the minimum value along an axis.
 
        Parameters
        ----------
        See `amin` for complete descriptions.
 
        See Also
        --------
        amin, ndarray.min
 
        Notes
        -----
        This is the same as `ndarray.min`, but returns a `matrix` object
        where `ndarray.min` would return an ndarray.
 
        Examples
        --------
        >>> x = -np.matrix(np.arange(12).reshape((3,4))); x
        matrix([[  0,  -1,  -2,  -3],
                [ -4,  -5,  -6,  -7],
                [ -8,  -9, -10, -11]])
        >>> x.min()
        -11
        >>> x.min(0)
        matrix([[ -8,  -9, -10, -11]])
        >>> x.min(1)
        matrix([[ -3],
                [ -7],
                [-11]])
 
        Tre)r4r5Úminrarsr"r"r#rw­s!z
matrix.mincCstj |||¡ |¡S)a¨
        Indexes of the minimum values along an axis.
 
        Return the indexes of the first occurrences of the minimum values
        along the specified axis.  If axis is None, the index is for the
        flattened matrix.
 
        Parameters
        ----------
        See `numpy.argmin` for complete descriptions.
 
        See Also
        --------
        numpy.argmin
 
        Notes
        -----
        This is the same as `ndarray.argmin`, but returns a `matrix` object
        where `ndarray.argmin` would return an `ndarray`.
 
        Examples
        --------
        >>> x = -np.matrix(np.arange(12).reshape((3,4))); x
        matrix([[  0,  -1,  -2,  -3],
                [ -4,  -5,  -6,  -7],
                [ -8,  -9, -10, -11]])
        >>> x.argmin()
        11
        >>> x.argmin(0)
        matrix([[2, 2, 2, 2]])
        >>> x.argmin(1)
        matrix([[3],
                [3],
                [3]])
 
        )r4r5Úargminr`rsr"r"r#rxÐs%z matrix.argmincCstj |||¡ |¡S)aÀ
        Peak-to-peak (maximum - minimum) value along the given axis.
 
        Refer to `numpy.ptp` for full documentation.
 
        See Also
        --------
        numpy.ptp
 
        Notes
        -----
        Same as `ndarray.ptp`, except, where that would return an `ndarray` object,
        this returns a `matrix` object.
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3,4))); x
        matrix([[ 0,  1,  2,  3],
                [ 4,  5,  6,  7],
                [ 8,  9, 10, 11]])
        >>> x.ptp()
        11
        >>> x.ptp(0)
        matrix([[8, 8, 8, 8]])
        >>> x.ptp(1)
        matrix([[3],
                [3],
                [3]])
 
        )r4r5Úptpr`rsr"r"r#ry÷sz
matrix.ptpcCs8|j\}}||kr ddlm}n ddlm}t||ƒƒS)aI
        Returns the (multiplicative) inverse of invertible `self`.
 
        Parameters
        ----------
        None
 
        Returns
        -------
        ret : matrix object
            If `self` is non-singular, `ret` is such that ``ret * self`` ==
            ``self * ret`` == ``np.matrix(np.eye(self[0,:].size))`` all return
            ``True``.
 
        Raises
        ------
        numpy.linalg.LinAlgError: Singular matrix
            If `self` is singular.
 
        See Also
        --------
        linalg.inv
 
        Examples
        --------
        >>> m = np.matrix('[1, 2; 3, 4]'); m
        matrix([[1, 2],
                [3, 4]])
        >>> m.getI()
        matrix([[-2. ,  1. ],
                [ 1.5, -0.5]])
        >>> m.getI() * m
        matrix([[ 1.,  0.], # may vary
                [ 0.,  1.]])
 
        r)Úinv)Úpinv)r:Ú numpy.linalgrzr{r)rFÚMr4Úfuncr"r"r#ÚIs
&
 zmatrix.IcCs| ¡S)a1
        Return `self` as an `ndarray` object.
 
        Equivalent to ``np.asarray(self)``.
 
        Parameters
        ----------
        None
 
        Returns
        -------
        ret : ndarray
            `self` as an `ndarray`
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3,4))); x
        matrix([[ 0,  1,  2,  3],
                [ 4,  5,  6,  7],
                [ 8,  9, 10, 11]])
        >>> x.getA()
        array([[ 0,  1,  2,  3],
               [ 4,  5,  6,  7],
               [ 8,  9, 10, 11]])
 
        )rbrdr"r"r#ÚAEszmatrix.AcCs | ¡ ¡S)a
        Return `self` as a flattened `ndarray`.
 
        Equivalent to ``np.asarray(x).ravel()``
 
        Parameters
        ----------
        None
 
        Returns
        -------
        ret : ndarray
            `self`, 1-D, as an `ndarray`
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3,4))); x
        matrix([[ 0,  1,  2,  3],
                [ 4,  5,  6,  7],
                [ 8,  9, 10, 11]])
        >>> x.getA1()
        array([ 0,  1,  2, ...,  9, 10, 11])
 
 
        )rbÚravelrdr"r"r#ÚA1csz    matrix.A1cCstjj||dS)a    
        Return a flattened matrix.
 
        Refer to `numpy.ravel` for more documentation.
 
        Parameters
        ----------
        order : {'C', 'F', 'A', 'K'}, optional
            The elements of `m` are read using this index order. 'C' means to
            index the elements in C-like order, with the last axis index
            changing fastest, back to the first axis index changing slowest.
            'F' means to index the elements in Fortran-like index order, with
            the first index changing fastest, and the last index changing
            slowest. Note that the 'C' and 'F' options take no account of the
            memory layout of the underlying array, and only refer to the order
            of axis indexing.  'A' means to read the elements in Fortran-like
            index order if `m` is Fortran *contiguous* in memory, C-like order
            otherwise.  'K' means to read the elements in the order they occur
            in memory, except for reversing the data when strides are negative.
            By default, 'C' index order is used.
 
        Returns
        -------
        ret : matrix
            Return the matrix flattened to shape `(1, N)` where `N`
            is the number of elements in the original matrix.
            A copy is made only if necessary.
 
        See Also
        --------
        matrix.flatten : returns a similar output matrix but always a copy
        matrix.flat : a flat iterator on the array.
        numpy.ravel : related function which returns an ndarray
 
        rj)r4r5rrlr"r"r#rs$z matrix.ravelcCs| ¡S)a@
        Returns the transpose of the matrix.
 
        Does *not* conjugate!  For the complex conjugate transpose, use ``.H``.
 
        Parameters
        ----------
        None
 
        Returns
        -------
        ret : matrix object
            The (non-conjugated) transpose of the matrix.
 
        See Also
        --------
        transpose, getH
 
        Examples
        --------
        >>> m = np.matrix('[1, 2; 3, 4]')
        >>> m
        matrix([[1, 2],
                [3, 4]])
        >>> m.getT()
        matrix([[1, 3],
                [2, 4]])
 
        )r]rdr"r"r#ÚT§szmatrix.TcCs(t|jjtjƒr| ¡ ¡S| ¡SdS)a:
        Returns the (complex) conjugate transpose of `self`.
 
        Equivalent to ``np.transpose(self)`` if `self` is real-valued.
 
        Parameters
        ----------
        None
 
        Returns
        -------
        ret : matrix object
            complex conjugate transpose of `self`
 
        Examples
        --------
        >>> x = np.matrix(np.arange(12).reshape((3,4)))
        >>> z = x - 1j*x; z
        matrix([[  0. +0.j,   1. -1.j,   2. -2.j,   3. -3.j],
                [  4. -4.j,   5. -5.j,   6. -6.j,   7. -7.j],
                [  8. -8.j,   9. -9.j,  10.-10.j,  11.-11.j]])
        >>> z.getH()
        matrix([[ 0. -0.j,  4. +4.j,  8. +8.j],
                [ 1. +1.j,  5. +5.j,  9. +9.j],
                [ 2. +2.j,  6. +6.j, 10.+10.j],
                [ 3. +3.j,  7. +7.j, 11.+11.j]])
 
        N)Ú
issubclassr'Útyper4Zcomplexfloatingr]Ú    conjugaterdr"r"r#ÚHÈs zmatrix.H)NT)NNN)N)r,)NNN)NNNr)NNNr)NNN)NN)NN)NN)NN)NN)NN)NN)r,),Ú__name__Ú
__module__Ú __qualname__Ú__doc__Z__array_priority__r=rHrIrVrOrXrYrZr[r`rarcrfrirkrmrnrprqrrrtrurvrwrxryÚpropertyrr€r‚rrƒr‡ÚfgetZgetTZgetAZgetA1ZgetHZgetIr"r"r"r#rHsX(
4  
$
5
%
"
"
"
!
 
(
#
'
#
'
!
,
 
 
&
 
#c Csä| d¡}g}|D]Ä}| d¡}g}|D]}| | ¡¡q(|}g}    |D]z}
|
 ¡}
z ||
} WnVtk
r¶z ||
} Wn4tk
r°} ztd|
›dƒd‚W5d} ~ XYnXYnX|     | ¡qH| t|    dd¡qt|ddS)Nr r zname z is not definedéÿÿÿÿrhr)rrÚstripÚKeyErrorÚ    NameErrorrr) r7ÚgdictÚldictrZrowtuprrrrBZcoltupr ZthismatÚer"r"r#Ú _from_stringòs*
 
  * r•cCs¸t|tƒrB|dkr*t ¡j}|j}|j}n|}|}tt|||ƒƒSt|t    t
fƒr g}|D]6}t|t j ƒr|tt |ddƒS| t |dd¡qXtt |ddƒSt|t j ƒr´t|ƒSdS)aˆ
    Build a matrix object from a string, nested sequence, or array.
 
    Parameters
    ----------
    obj : str or array_like
        Input data. If a string, variables in the current scope may be
        referenced by name.
    ldict : dict, optional
        A dictionary that replaces local operands in current frame.
        Ignored if `obj` is not a string or `gdict` is None.
    gdict : dict, optional
        A dictionary that replaces global operands in current frame.
        Ignored if `obj` is not a string.
 
    Returns
    -------
    out : matrix
        Returns a matrix object, which is a specialized 2-D array.
 
    See Also
    --------
    block :
        A generalization of this function for N-d arrays, that returns normal
        ndarrays.
 
    Examples
    --------
    >>> A = np.mat('1 1; 1 1')
    >>> B = np.mat('2 2; 2 2')
    >>> C = np.mat('3 4; 5 6')
    >>> D = np.mat('7 8; 9 0')
 
    All the following expressions construct the same block matrix:
 
    >>> np.bmat([[A, B], [C, D]])
    matrix([[1, 1, 2, 2],
            [1, 1, 2, 2],
            [3, 4, 7, 8],
            [5, 6, 9, 0]])
    >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]])
    matrix([[1, 1, 2, 2],
            [1, 1, 2, 2],
            [3, 4, 7, 8],
            [5, 6, 9, 0]])
    >>> np.bmat('A,B; C,D')
    matrix([[1, 1, 2, 2],
            [1, 1, 2, 2],
            [3, 4, 7, 8],
            [5, 6, 9, 0]])
 
    NrŽrhr)r3r7ÚsysÚ    _getframeÚf_backÚ    f_globalsÚf_localsrr•rErPr4r5rr)rGr“r’ÚframeZ    glob_dictZloc_dictZarr_rowsrr"r"r#r s"6
 
  )N)NN)Ú__all__r–r0rZnumpy.core.numericÚcoreÚnumericr4rrZnumpy.core.overridesrr|r
r$rr5rr•rrr"r"r"r#Ú<module>s.    #0 M