| ofs | hex dump | ascii |
|---|
| 0000 | cb 0d 0d 0a 00 00 00 00 0d fd a7 68 26 15 00 00 e3 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 | ...........h&................... |
| 0020 | 00 00 00 00 00 f3 08 00 00 00 97 00 64 00 5a 00 79 01 29 02 61 1d 15 00 00 0a 3d 3d 3d 3d 3d 3d | ............d.Z.y.).a.....====== |
| 0040 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 55 6e 69 76 65 72 73 61 6c 20 46 75 6e 63 74 69 6f 6e | =============.Universal.Function |
| 0060 | 73 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 55 66 75 6e 63 73 20 61 72 | s.===================..Ufuncs.ar |
| 0080 | 65 2c 20 67 65 6e 65 72 61 6c 6c 79 20 73 70 65 61 6b 69 6e 67 2c 20 6d 61 74 68 65 6d 61 74 69 | e,.generally.speaking,.mathemati |
| 00a0 | 63 61 6c 20 66 75 6e 63 74 69 6f 6e 73 20 6f 72 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 | cal.functions.or.operations.that |
| 00c0 | 20 61 72 65 0a 61 70 70 6c 69 65 64 20 65 6c 65 6d 65 6e 74 2d 62 79 2d 65 6c 65 6d 65 6e 74 20 | .are.applied.element-by-element. |
| 00e0 | 74 6f 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 61 6e 20 61 72 72 61 79 2e 20 54 68 61 | to.the.contents.of.an.array..Tha |
| 0100 | 74 20 69 73 2c 20 74 68 65 20 72 65 73 75 6c 74 0a 69 6e 20 65 61 63 68 20 6f 75 74 70 75 74 20 | t.is,.the.result.in.each.output. |
| 0120 | 61 72 72 61 79 20 65 6c 65 6d 65 6e 74 20 6f 6e 6c 79 20 64 65 70 65 6e 64 73 20 6f 6e 20 74 68 | array.element.only.depends.on.th |
| 0140 | 65 20 76 61 6c 75 65 20 69 6e 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 0a 69 6e 70 | e.value.in.the.corresponding.inp |
| 0160 | 75 74 20 61 72 72 61 79 20 28 6f 72 20 61 72 72 61 79 73 29 20 61 6e 64 20 6f 6e 20 6e 6f 20 6f | ut.array.(or.arrays).and.on.no.o |
| 0180 | 74 68 65 72 20 61 72 72 61 79 20 65 6c 65 6d 65 6e 74 73 2e 20 4e 75 6d 50 79 20 63 6f 6d 65 73 | ther.array.elements..NumPy.comes |
| 01a0 | 20 77 69 74 68 20 61 0a 6c 61 72 67 65 20 73 75 69 74 65 20 6f 66 20 75 66 75 6e 63 73 2c 20 61 | .with.a.large.suite.of.ufuncs,.a |
| 01c0 | 6e 64 20 73 63 69 70 79 20 65 78 74 65 6e 64 73 20 74 68 61 74 20 73 75 69 74 65 20 73 75 62 73 | nd.scipy.extends.that.suite.subs |
| 01e0 | 74 61 6e 74 69 61 6c 6c 79 2e 20 54 68 65 20 73 69 6d 70 6c 65 73 74 0a 65 78 61 6d 70 6c 65 20 | tantially..The.simplest.example. |
| 0200 | 69 73 20 74 68 65 20 61 64 64 69 74 69 6f 6e 20 6f 70 65 72 61 74 6f 72 3a 20 3a 3a 0a 0a 20 3e | is.the.addition.operator:.::...> |
| 0220 | 3e 3e 20 6e 70 2e 61 72 72 61 79 28 5b 30 2c 32 2c 33 2c 34 5d 29 20 2b 20 6e 70 2e 61 72 72 61 | >>.np.array([0,2,3,4]).+.np.arra |
| 0240 | 79 28 5b 31 2c 31 2c 2d 31 2c 32 5d 29 0a 20 61 72 72 61 79 28 5b 31 2c 20 33 2c 20 32 2c 20 36 | y([1,1,-1,2])..array([1,.3,.2,.6 |
| 0260 | 5d 29 0a 0a 54 68 65 20 75 66 75 6e 63 20 6d 6f 64 75 6c 65 20 6c 69 73 74 73 20 61 6c 6c 20 74 | ])..The.ufunc.module.lists.all.t |
| 0280 | 68 65 20 61 76 61 69 6c 61 62 6c 65 20 75 66 75 6e 63 73 20 69 6e 20 6e 75 6d 70 79 2e 20 44 6f | he.available.ufuncs.in.numpy..Do |
| 02a0 | 63 75 6d 65 6e 74 61 74 69 6f 6e 20 6f 6e 0a 74 68 65 20 73 70 65 63 69 66 69 63 20 75 66 75 6e | cumentation.on.the.specific.ufun |
| 02c0 | 63 73 20 6d 61 79 20 62 65 20 66 6f 75 6e 64 20 69 6e 20 74 68 6f 73 65 20 6d 6f 64 75 6c 65 73 | cs.may.be.found.in.those.modules |
| 02e0 | 2e 20 54 68 69 73 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 69 73 0a 69 6e 74 65 6e 64 65 64 | ..This.documentation.is.intended |
| 0300 | 20 74 6f 20 61 64 64 72 65 73 73 20 74 68 65 20 6d 6f 72 65 20 67 65 6e 65 72 61 6c 20 61 73 70 | .to.address.the.more.general.asp |
| 0320 | 65 63 74 73 20 6f 66 20 75 66 75 6e 63 73 20 63 6f 6d 6d 6f 6e 20 74 6f 20 6d 6f 73 74 20 6f 66 | ects.of.ufuncs.common.to.most.of |
| 0340 | 0a 74 68 65 6d 2e 20 41 6c 6c 20 6f 66 20 74 68 65 20 75 66 75 6e 63 73 20 74 68 61 74 20 6d 61 | .them..All.of.the.ufuncs.that.ma |
| 0360 | 6b 65 20 75 73 65 20 6f 66 20 50 79 74 68 6f 6e 20 6f 70 65 72 61 74 6f 72 73 20 28 65 2e 67 2e | ke.use.of.Python.operators.(e.g. |
| 0380 | 2c 20 2b 2c 20 2d 2c 20 65 74 63 2e 29 0a 68 61 76 65 20 65 71 75 69 76 61 6c 65 6e 74 20 66 75 | ,.+,.-,.etc.).have.equivalent.fu |
| 03a0 | 6e 63 74 69 6f 6e 73 20 64 65 66 69 6e 65 64 20 28 65 2e 67 2e 20 61 64 64 28 29 20 66 6f 72 20 | nctions.defined.(e.g..add().for. |
| 03c0 | 2b 29 0a 0a 54 79 70 65 20 63 6f 65 72 63 69 6f 6e 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a | +)..Type.coercion.=============. |
| 03e0 | 0a 57 68 61 74 20 68 61 70 70 65 6e 73 20 77 68 65 6e 20 61 20 62 69 6e 61 72 79 20 6f 70 65 72 | .What.happens.when.a.binary.oper |
| 0400 | 61 74 6f 72 20 28 65 2e 67 2e 2c 20 2b 2c 2d 2c 5c 2a 2c 2f 2c 20 65 74 63 29 20 64 65 61 6c 73 | ator.(e.g.,.+,-,\*,/,.etc).deals |
| 0420 | 20 77 69 74 68 20 61 72 72 61 79 73 20 6f 66 0a 74 77 6f 20 64 69 66 66 65 72 65 6e 74 20 74 79 | .with.arrays.of.two.different.ty |
| 0440 | 70 65 73 3f 20 57 68 61 74 20 69 73 20 74 68 65 20 74 79 70 65 20 6f 66 20 74 68 65 20 72 65 73 | pes?.What.is.the.type.of.the.res |
| 0460 | 75 6c 74 3f 20 54 79 70 69 63 61 6c 6c 79 2c 20 74 68 65 20 72 65 73 75 6c 74 20 69 73 0a 74 68 | ult?.Typically,.the.result.is.th |
| 0480 | 65 20 68 69 67 68 65 72 20 6f 66 20 74 68 65 20 74 77 6f 20 74 79 70 65 73 2e 20 46 6f 72 20 65 | e.higher.of.the.two.types..For.e |
| 04a0 | 78 61 6d 70 6c 65 3a 20 3a 3a 0a 0a 20 66 6c 6f 61 74 33 32 20 2b 20 66 6c 6f 61 74 36 34 20 2d | xample:.::...float32.+.float64.- |
| 04c0 | 3e 20 66 6c 6f 61 74 36 34 0a 20 69 6e 74 38 20 2b 20 69 6e 74 33 32 20 2d 3e 20 69 6e 74 33 32 | >.float64..int8.+.int32.->.int32 |
| 04e0 | 0a 20 69 6e 74 31 36 20 2b 20 66 6c 6f 61 74 33 32 20 2d 3e 20 66 6c 6f 61 74 33 32 0a 20 66 6c | ..int16.+.float32.->.float32..fl |
| 0500 | 6f 61 74 33 32 20 2b 20 63 6f 6d 70 6c 65 78 36 34 20 2d 3e 20 63 6f 6d 70 6c 65 78 36 34 0a 0a | oat32.+.complex64.->.complex64.. |
| 0520 | 54 68 65 72 65 20 61 72 65 20 73 6f 6d 65 20 6c 65 73 73 20 6f 62 76 69 6f 75 73 20 63 61 73 65 | There.are.some.less.obvious.case |
| 0540 | 73 20 67 65 6e 65 72 61 6c 6c 79 20 69 6e 76 6f 6c 76 69 6e 67 20 6d 69 78 65 73 20 6f 66 20 74 | s.generally.involving.mixes.of.t |
| 0560 | 79 70 65 73 0a 28 65 2e 67 2e 20 75 69 6e 74 73 2c 20 69 6e 74 73 20 61 6e 64 20 66 6c 6f 61 74 | ypes.(e.g..uints,.ints.and.float |
| 0580 | 73 29 20 77 68 65 72 65 20 65 71 75 61 6c 20 62 69 74 20 73 69 7a 65 73 20 66 6f 72 20 65 61 63 | s).where.equal.bit.sizes.for.eac |
| 05a0 | 68 20 61 72 65 20 6e 6f 74 0a 63 61 70 61 62 6c 65 20 6f 66 20 73 61 76 69 6e 67 20 61 6c 6c 20 | h.are.not.capable.of.saving.all. |
| 05c0 | 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 6e 20 61 20 64 69 66 66 65 72 65 6e 74 20 74 | the.information.in.a.different.t |
| 05e0 | 79 70 65 20 6f 66 20 65 71 75 69 76 61 6c 65 6e 74 0a 62 69 74 20 73 69 7a 65 2e 20 53 6f 6d 65 | ype.of.equivalent.bit.size..Some |
| 0600 | 20 65 78 61 6d 70 6c 65 73 20 61 72 65 20 69 6e 74 33 32 20 76 73 20 66 6c 6f 61 74 33 32 20 6f | .examples.are.int32.vs.float32.o |
| 0620 | 72 20 75 69 6e 74 33 32 20 76 73 20 69 6e 74 33 32 2e 0a 47 65 6e 65 72 61 6c 6c 79 2c 20 74 68 | r.uint32.vs.int32..Generally,.th |
| 0640 | 65 20 72 65 73 75 6c 74 20 69 73 20 74 68 65 20 68 69 67 68 65 72 20 74 79 70 65 20 6f 66 20 6c | e.result.is.the.higher.type.of.l |
| 0660 | 61 72 67 65 72 20 73 69 7a 65 20 74 68 61 6e 20 62 6f 74 68 0a 28 69 66 20 61 76 61 69 6c 61 62 | arger.size.than.both.(if.availab |
| 0680 | 6c 65 29 2e 20 53 6f 3a 20 3a 3a 0a 0a 20 69 6e 74 33 32 20 2b 20 66 6c 6f 61 74 33 32 20 2d 3e | le)..So:.::...int32.+.float32.-> |
| 06a0 | 20 66 6c 6f 61 74 36 34 0a 20 75 69 6e 74 33 32 20 2b 20 69 6e 74 33 32 20 2d 3e 20 69 6e 74 36 | .float64..uint32.+.int32.->.int6 |
| 06c0 | 34 0a 0a 46 69 6e 61 6c 6c 79 2c 20 74 68 65 20 74 79 70 65 20 63 6f 65 72 63 69 6f 6e 20 62 65 | 4..Finally,.the.type.coercion.be |
| 06e0 | 68 61 76 69 6f 72 20 77 68 65 6e 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 76 6f 6c 76 65 20 | havior.when.expressions.involve. |
| 0700 | 50 79 74 68 6f 6e 0a 73 63 61 6c 61 72 73 20 69 73 20 64 69 66 66 65 72 65 6e 74 20 74 68 61 6e | Python.scalars.is.different.than |
| 0720 | 20 74 68 61 74 20 73 65 65 6e 20 66 6f 72 20 61 72 72 61 79 73 2e 20 53 69 6e 63 65 20 50 79 74 | .that.seen.for.arrays..Since.Pyt |
| 0740 | 68 6f 6e 20 68 61 73 20 61 0a 6c 69 6d 69 74 65 64 20 6e 75 6d 62 65 72 20 6f 66 20 74 79 70 65 | hon.has.a.limited.number.of.type |
| 0760 | 73 2c 20 63 6f 6d 62 69 6e 69 6e 67 20 61 20 50 79 74 68 6f 6e 20 69 6e 74 20 77 69 74 68 20 61 | s,.combining.a.Python.int.with.a |
| 0780 | 20 64 74 79 70 65 3d 6e 70 2e 69 6e 74 38 0a 61 72 72 61 79 20 64 6f 65 73 20 6e 6f 74 20 63 6f | .dtype=np.int8.array.does.not.co |
| 07a0 | 65 72 63 65 20 74 6f 20 74 68 65 20 68 69 67 68 65 72 20 74 79 70 65 20 62 75 74 20 69 6e 73 74 | erce.to.the.higher.type.but.inst |
| 07c0 | 65 61 64 2c 20 74 68 65 20 74 79 70 65 20 6f 66 20 74 68 65 0a 61 72 72 61 79 20 70 72 65 76 61 | ead,.the.type.of.the.array.preva |
| 07e0 | 69 6c 73 2e 20 53 6f 20 74 68 65 20 72 75 6c 65 73 20 66 6f 72 20 50 79 74 68 6f 6e 20 73 63 61 | ils..So.the.rules.for.Python.sca |
| 0800 | 6c 61 72 73 20 63 6f 6d 62 69 6e 65 64 20 77 69 74 68 20 61 72 72 61 79 73 20 69 73 0a 74 68 61 | lars.combined.with.arrays.is.tha |
| 0820 | 74 20 74 68 65 20 72 65 73 75 6c 74 20 77 69 6c 6c 20 62 65 20 74 68 61 74 20 6f 66 20 74 68 65 | t.the.result.will.be.that.of.the |
| 0840 | 20 61 72 72 61 79 20 65 71 75 69 76 61 6c 65 6e 74 20 74 68 65 20 50 79 74 68 6f 6e 20 73 63 61 | .array.equivalent.the.Python.sca |
| 0860 | 6c 61 72 0a 69 66 20 74 68 65 20 50 79 74 68 6f 6e 20 73 63 61 6c 61 72 20 69 73 20 6f 66 20 61 | lar.if.the.Python.scalar.is.of.a |
| 0880 | 20 68 69 67 68 65 72 20 27 6b 69 6e 64 27 20 74 68 61 6e 20 74 68 65 20 61 72 72 61 79 20 28 65 | .higher.'kind'.than.the.array.(e |
| 08a0 | 2e 67 2e 2c 20 66 6c 6f 61 74 0a 76 73 2e 20 69 6e 74 29 2c 20 6f 74 68 65 72 77 69 73 65 20 74 | .g.,.float.vs..int),.otherwise.t |
| 08c0 | 68 65 20 72 65 73 75 6c 74 61 6e 74 20 74 79 70 65 20 77 69 6c 6c 20 62 65 20 74 68 61 74 20 6f | he.resultant.type.will.be.that.o |
| 08e0 | 66 20 74 68 65 20 61 72 72 61 79 2e 0a 46 6f 72 20 65 78 61 6d 70 6c 65 3a 20 3a 3a 0a 0a 20 20 | f.the.array..For.example:.::.... |
| 0900 | 50 79 74 68 6f 6e 20 69 6e 74 20 2b 20 69 6e 74 38 20 2d 3e 20 69 6e 74 38 0a 20 20 50 79 74 68 | Python.int.+.int8.->.int8...Pyth |
| 0920 | 6f 6e 20 66 6c 6f 61 74 20 2b 20 69 6e 74 38 20 2d 3e 20 66 6c 6f 61 74 36 34 0a 0a 75 66 75 6e | on.float.+.int8.->.float64..ufun |
| 0940 | 63 20 6d 65 74 68 6f 64 73 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 42 69 6e 61 72 79 20 | c.methods.=============..Binary. |
| 0960 | 75 66 75 6e 63 73 20 73 75 70 70 6f 72 74 20 34 20 6d 65 74 68 6f 64 73 2e 0a 0a 2a 2a 2e 72 65 | ufuncs.support.4.methods...**.re |
| 0980 | 64 75 63 65 28 61 72 72 29 2a 2a 20 61 70 70 6c 69 65 73 20 74 68 65 20 62 69 6e 61 72 79 20 6f | duce(arr)**.applies.the.binary.o |
| 09a0 | 70 65 72 61 74 6f 72 20 74 6f 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 74 68 65 20 61 72 72 61 79 | perator.to.elements.of.the.array |
| 09c0 | 20 69 6e 0a 20 20 73 65 71 75 65 6e 63 65 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65 3a 20 3a 3a 0a | .in...sequence..For.example:.::. |
| 09e0 | 0a 20 3e 3e 3e 20 6e 70 2e 61 64 64 2e 72 65 64 75 63 65 28 6e 70 2e 61 72 61 6e 67 65 28 31 30 | ..>>>.np.add.reduce(np.arange(10 |
| 0a00 | 29 29 20 20 23 20 61 64 64 73 20 61 6c 6c 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 61 72 72 61 79 | ))..#.adds.all.elements.of.array |
| 0a20 | 0a 20 34 35 0a 0a 46 6f 72 20 6d 75 6c 74 69 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 61 72 72 61 79 | ..45..For.multidimensional.array |
| 0a40 | 73 2c 20 74 68 65 20 66 69 72 73 74 20 64 69 6d 65 6e 73 69 6f 6e 20 69 73 20 72 65 64 75 63 65 | s,.the.first.dimension.is.reduce |
| 0a60 | 64 20 62 79 20 64 65 66 61 75 6c 74 3a 20 3a 3a 0a 0a 20 3e 3e 3e 20 6e 70 2e 61 64 64 2e 72 65 | d.by.default:.::...>>>.np.add.re |
| 0a80 | 64 75 63 65 28 6e 70 2e 61 72 61 6e 67 65 28 31 30 29 2e 72 65 73 68 61 70 65 28 32 2c 35 29 29 | duce(np.arange(10).reshape(2,5)) |
| 0aa0 | 0a 20 20 20 20 20 61 72 72 61 79 28 5b 20 35 2c 20 20 37 2c 20 20 39 2c 20 31 31 2c 20 31 33 5d | ......array([.5,..7,..9,.11,.13] |
| 0ac0 | 29 0a 0a 54 68 65 20 61 78 69 73 20 6b 65 79 77 6f 72 64 20 63 61 6e 20 62 65 20 75 73 65 64 20 | )..The.axis.keyword.can.be.used. |
| 0ae0 | 74 6f 20 73 70 65 63 69 66 79 20 64 69 66 66 65 72 65 6e 74 20 61 78 65 73 20 74 6f 20 72 65 64 | to.specify.different.axes.to.red |
| 0b00 | 75 63 65 3a 20 3a 3a 0a 0a 20 3e 3e 3e 20 6e 70 2e 61 64 64 2e 72 65 64 75 63 65 28 6e 70 2e 61 | uce:.::...>>>.np.add.reduce(np.a |
| 0b20 | 72 61 6e 67 65 28 31 30 29 2e 72 65 73 68 61 70 65 28 32 2c 35 29 2c 61 78 69 73 3d 31 29 0a 20 | range(10).reshape(2,5),axis=1).. |
| 0b40 | 61 72 72 61 79 28 5b 31 30 2c 20 33 35 5d 29 0a 0a 2a 2a 2e 61 63 63 75 6d 75 6c 61 74 65 28 61 | array([10,.35])..**.accumulate(a |
| 0b60 | 72 72 29 2a 2a 20 61 70 70 6c 69 65 73 20 74 68 65 20 62 69 6e 61 72 79 20 6f 70 65 72 61 74 6f | rr)**.applies.the.binary.operato |
| 0b80 | 72 20 61 6e 64 20 67 65 6e 65 72 61 74 65 73 20 61 6e 0a 65 71 75 69 76 61 6c 65 6e 74 6c 79 20 | r.and.generates.an.equivalently. |
| 0ba0 | 73 68 61 70 65 64 20 61 72 72 61 79 20 74 68 61 74 20 69 6e 63 6c 75 64 65 73 20 74 68 65 20 61 | shaped.array.that.includes.the.a |
| 0bc0 | 63 63 75 6d 75 6c 61 74 65 64 20 61 6d 6f 75 6e 74 20 66 6f 72 20 65 61 63 68 0a 65 6c 65 6d 65 | ccumulated.amount.for.each.eleme |
| 0be0 | 6e 74 20 6f 66 20 74 68 65 20 61 72 72 61 79 2e 20 41 20 63 6f 75 70 6c 65 20 65 78 61 6d 70 6c | nt.of.the.array..A.couple.exampl |
| 0c00 | 65 73 3a 20 3a 3a 0a 0a 20 3e 3e 3e 20 6e 70 2e 61 64 64 2e 61 63 63 75 6d 75 6c 61 74 65 28 6e | es:.::...>>>.np.add.accumulate(n |
| 0c20 | 70 2e 61 72 61 6e 67 65 28 31 30 29 29 0a 20 61 72 72 61 79 28 5b 20 30 2c 20 20 31 2c 20 20 33 | p.arange(10))..array([.0,..1,..3 |
| 0c40 | 2c 20 20 36 2c 20 31 30 2c 20 31 35 2c 20 32 31 2c 20 32 38 2c 20 33 36 2c 20 34 35 5d 29 0a 20 | ,..6,.10,.15,.21,.28,.36,.45]).. |
| 0c60 | 3e 3e 3e 20 6e 70 2e 6d 75 6c 74 69 70 6c 79 2e 61 63 63 75 6d 75 6c 61 74 65 28 6e 70 2e 61 72 | >>>.np.multiply.accumulate(np.ar |
| 0c80 | 61 6e 67 65 28 31 2c 39 29 29 0a 20 61 72 72 61 79 28 5b 20 20 20 20 31 2c 20 20 20 20 20 32 2c | ange(1,9))..array([....1,.....2, |
| 0ca0 | 20 20 20 20 20 36 2c 20 20 20 20 32 34 2c 20 20 20 31 32 30 2c 20 20 20 37 32 30 2c 20 20 35 30 | .....6,....24,...120,...720,..50 |
| 0cc0 | 34 30 2c 20 34 30 33 32 30 5d 29 0a 0a 54 68 65 20 62 65 68 61 76 69 6f 72 20 66 6f 72 20 6d 75 | 40,.40320])..The.behavior.for.mu |
| 0ce0 | 6c 74 69 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 61 72 72 61 79 73 20 69 73 20 74 68 65 20 73 61 6d | ltidimensional.arrays.is.the.sam |
| 0d00 | 65 20 61 73 20 66 6f 72 20 2e 72 65 64 75 63 65 28 29 2c 0a 61 73 20 69 73 20 74 68 65 20 75 73 | e.as.for..reduce(),.as.is.the.us |
| 0d20 | 65 20 6f 66 20 74 68 65 20 61 78 69 73 20 6b 65 79 77 6f 72 64 29 2e 0a 0a 2a 2a 2e 72 65 64 75 | e.of.the.axis.keyword)...**.redu |
| 0d40 | 63 65 61 74 28 61 72 72 2c 69 6e 64 69 63 65 73 29 2a 2a 20 61 6c 6c 6f 77 73 20 6f 6e 65 20 74 | ceat(arr,indices)**.allows.one.t |
| 0d60 | 6f 20 61 70 70 6c 79 20 72 65 64 75 63 65 20 74 6f 20 73 65 6c 65 63 74 65 64 20 70 61 72 74 73 | o.apply.reduce.to.selected.parts |
| 0d80 | 0a 20 20 6f 66 20 61 6e 20 61 72 72 61 79 2e 20 49 74 20 69 73 20 61 20 64 69 66 66 69 63 75 6c | ...of.an.array..It.is.a.difficul |
| 0da0 | 74 20 6d 65 74 68 6f 64 20 74 6f 20 75 6e 64 65 72 73 74 61 6e 64 2e 20 53 65 65 20 74 68 65 20 | t.method.to.understand..See.the. |
| 0dc0 | 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 0a 20 20 61 74 3a 0a 0a 2a 2a 2e 6f 75 74 65 72 28 61 72 | documentation...at:..**.outer(ar |
| 0de0 | 72 31 2c 61 72 72 32 29 2a 2a 20 67 65 6e 65 72 61 74 65 73 20 61 6e 20 6f 75 74 65 72 20 6f 70 | r1,arr2)**.generates.an.outer.op |
| 0e00 | 65 72 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20 74 77 6f 20 61 72 72 61 79 73 20 61 72 72 31 20 61 | eration.on.the.two.arrays.arr1.a |
| 0e20 | 6e 64 0a 20 20 61 72 72 32 2e 20 49 74 20 77 69 6c 6c 20 77 6f 72 6b 20 6f 6e 20 6d 75 6c 74 69 | nd...arr2..It.will.work.on.multi |
| 0e40 | 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 61 72 72 61 79 73 20 28 74 68 65 20 73 68 61 70 65 20 6f 66 | dimensional.arrays.(the.shape.of |
| 0e60 | 20 74 68 65 20 72 65 73 75 6c 74 20 69 73 0a 20 20 74 68 65 20 63 6f 6e 63 61 74 65 6e 61 74 69 | .the.result.is...the.concatenati |
| 0e80 | 6f 6e 20 6f 66 20 74 68 65 20 74 77 6f 20 69 6e 70 75 74 20 73 68 61 70 65 73 2e 3a 20 3a 3a 0a | on.of.the.two.input.shapes.:.::. |
| 0ea0 | 0a 20 3e 3e 3e 20 6e 70 2e 6d 75 6c 74 69 70 6c 79 2e 6f 75 74 65 72 28 6e 70 2e 61 72 61 6e 67 | ..>>>.np.multiply.outer(np.arang |
| 0ec0 | 65 28 33 29 2c 6e 70 2e 61 72 61 6e 67 65 28 34 29 29 0a 20 61 72 72 61 79 28 5b 5b 30 2c 20 30 | e(3),np.arange(4))..array([[0,.0 |
| 0ee0 | 2c 20 30 2c 20 30 5d 2c 0a 20 20 20 20 20 20 20 20 5b 30 2c 20 31 2c 20 32 2c 20 33 5d 2c 0a 20 | ,.0,.0],.........[0,.1,.2,.3],.. |
| 0f00 | 20 20 20 20 20 20 20 5b 30 2c 20 32 2c 20 34 2c 20 36 5d 5d 29 0a 0a 4f 75 74 70 75 74 20 61 72 | .......[0,.2,.4,.6]])..Output.ar |
| 0f20 | 67 75 6d 65 6e 74 73 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 41 6c 6c 20 75 66 | guments.================..All.uf |
| 0f40 | 75 6e 63 73 20 61 63 63 65 70 74 20 61 6e 20 6f 70 74 69 6f 6e 61 6c 20 6f 75 74 70 75 74 20 61 | uncs.accept.an.optional.output.a |
| 0f60 | 72 72 61 79 2e 20 54 68 65 20 61 72 72 61 79 20 6d 75 73 74 20 62 65 20 6f 66 20 74 68 65 20 65 | rray..The.array.must.be.of.the.e |
| 0f80 | 78 70 65 63 74 65 64 0a 6f 75 74 70 75 74 20 73 68 61 70 65 2e 20 42 65 77 61 72 65 20 74 68 61 | xpected.output.shape..Beware.tha |
| 0fa0 | 74 20 69 66 20 74 68 65 20 74 79 70 65 20 6f 66 20 74 68 65 20 6f 75 74 70 75 74 20 61 72 72 61 | t.if.the.type.of.the.output.arra |
| 0fc0 | 79 20 69 73 20 6f 66 20 61 20 64 69 66 66 65 72 65 6e 74 0a 28 61 6e 64 20 6c 6f 77 65 72 29 20 | y.is.of.a.different.(and.lower). |
| 0fe0 | 74 79 70 65 20 74 68 61 6e 20 74 68 65 20 6f 75 74 70 75 74 20 72 65 73 75 6c 74 2c 20 74 68 65 | type.than.the.output.result,.the |
| 1000 | 20 72 65 73 75 6c 74 73 20 6d 61 79 20 62 65 20 73 69 6c 65 6e 74 6c 79 20 74 72 75 6e 63 61 74 | .results.may.be.silently.truncat |
| 1020 | 65 64 0a 6f 72 20 6f 74 68 65 72 77 69 73 65 20 63 6f 72 72 75 70 74 65 64 20 69 6e 20 74 68 65 | ed.or.otherwise.corrupted.in.the |
| 1040 | 20 64 6f 77 6e 63 61 73 74 20 74 6f 20 74 68 65 20 6c 6f 77 65 72 20 74 79 70 65 2e 20 54 68 69 | .downcast.to.the.lower.type..Thi |
| 1060 | 73 20 75 73 61 67 65 20 69 73 20 75 73 65 66 75 6c 0a 77 68 65 6e 20 6f 6e 65 20 77 61 6e 74 73 | s.usage.is.useful.when.one.wants |
| 1080 | 20 74 6f 20 61 76 6f 69 64 20 63 72 65 61 74 69 6e 67 20 6c 61 72 67 65 20 74 65 6d 70 6f 72 61 | .to.avoid.creating.large.tempora |
| 10a0 | 72 79 20 61 72 72 61 79 73 20 61 6e 64 20 69 6e 73 74 65 61 64 20 61 6c 6c 6f 77 73 20 6f 6e 65 | ry.arrays.and.instead.allows.one |
| 10c0 | 0a 74 6f 20 72 65 75 73 65 20 74 68 65 20 73 61 6d 65 20 61 72 72 61 79 20 6d 65 6d 6f 72 79 20 | .to.reuse.the.same.array.memory. |
| 10e0 | 72 65 70 65 61 74 65 64 6c 79 20 28 61 74 20 74 68 65 20 65 78 70 65 6e 73 65 20 6f 66 20 6e 6f | repeatedly.(at.the.expense.of.no |
| 1100 | 74 20 62 65 69 6e 67 20 61 62 6c 65 20 74 6f 0a 75 73 65 20 6d 6f 72 65 20 63 6f 6e 76 65 6e 69 | t.being.able.to.use.more.conveni |
| 1120 | 65 6e 74 20 6f 70 65 72 61 74 6f 72 20 6e 6f 74 61 74 69 6f 6e 20 69 6e 20 65 78 70 72 65 73 73 | ent.operator.notation.in.express |
| 1140 | 69 6f 6e 73 29 2e 20 4e 6f 74 65 20 74 68 61 74 20 77 68 65 6e 20 74 68 65 0a 6f 75 74 70 75 74 | ions)..Note.that.when.the.output |
| 1160 | 20 61 72 67 75 6d 65 6e 74 20 69 73 20 75 73 65 64 2c 20 74 68 65 20 75 66 75 6e 63 20 73 74 69 | .argument.is.used,.the.ufunc.sti |
| 1180 | 6c 6c 20 72 65 74 75 72 6e 73 20 61 20 72 65 66 65 72 65 6e 63 65 20 74 6f 20 74 68 65 20 72 65 | ll.returns.a.reference.to.the.re |
| 11a0 | 73 75 6c 74 2e 0a 0a 20 3e 3e 3e 20 78 20 3d 20 6e 70 2e 61 72 61 6e 67 65 28 32 29 0a 20 3e 3e | sult....>>>.x.=.np.arange(2)..>> |
| 11c0 | 3e 20 6e 70 2e 61 64 64 28 6e 70 2e 61 72 61 6e 67 65 28 32 2c 20 64 74 79 70 65 3d 66 6c 6f 61 | >.np.add(np.arange(2,.dtype=floa |
| 11e0 | 74 29 2c 20 6e 70 2e 61 72 61 6e 67 65 28 32 2c 20 64 74 79 70 65 3d 66 6c 6f 61 74 29 2c 20 78 | t),.np.arange(2,.dtype=float),.x |
| 1200 | 2c 0a 20 2e 2e 2e 20 20 20 20 20 20 20 20 63 61 73 74 69 6e 67 3d 27 75 6e 73 61 66 65 27 29 0a | ,.............casting='unsafe'). |
| 1220 | 20 61 72 72 61 79 28 5b 30 2c 20 32 5d 29 0a 20 3e 3e 3e 20 78 0a 20 61 72 72 61 79 28 5b 30 2c | .array([0,.2])..>>>.x..array([0, |
| 1240 | 20 32 5d 29 0a 0a 61 6e 64 20 26 20 6f 72 20 61 73 20 75 66 75 6e 63 73 0a 3d 3d 3d 3d 3d 3d 3d | .2])..and.&.or.as.ufuncs.======= |
| 1260 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 49 6e 76 61 72 69 61 62 6c 79 20 70 65 6f 70 6c 65 20 74 | ===========..Invariably.people.t |
| 1280 | 72 79 20 74 6f 20 75 73 65 20 74 68 65 20 70 79 74 68 6f 6e 20 27 61 6e 64 27 20 61 6e 64 20 27 | ry.to.use.the.python.'and'.and.' |
| 12a0 | 6f 72 27 20 61 73 20 6c 6f 67 69 63 61 6c 20 6f 70 65 72 61 74 6f 72 73 0a 28 61 6e 64 20 71 75 | or'.as.logical.operators.(and.qu |
| 12c0 | 69 74 65 20 75 6e 64 65 72 73 74 61 6e 64 61 62 6c 79 29 2e 20 42 75 74 20 74 68 65 73 65 20 6f | ite.understandably)..But.these.o |
| 12e0 | 70 65 72 61 74 6f 72 73 20 64 6f 20 6e 6f 74 20 62 65 68 61 76 65 20 61 73 20 6e 6f 72 6d 61 6c | perators.do.not.behave.as.normal |
| 1300 | 0a 6f 70 65 72 61 74 6f 72 73 20 73 69 6e 63 65 20 50 79 74 68 6f 6e 20 74 72 65 61 74 73 20 74 | .operators.since.Python.treats.t |
| 1320 | 68 65 73 65 20 71 75 69 74 65 20 64 69 66 66 65 72 65 6e 74 6c 79 2e 20 54 68 65 79 20 63 61 6e | hese.quite.differently..They.can |
| 1340 | 6e 6f 74 20 62 65 0a 6f 76 65 72 6c 6f 61 64 65 64 20 77 69 74 68 20 61 72 72 61 79 20 65 71 75 | not.be.overloaded.with.array.equ |
| 1360 | 69 76 61 6c 65 6e 74 73 2e 20 54 68 75 73 20 75 73 69 6e 67 20 27 61 6e 64 27 20 6f 72 20 27 6f | ivalents..Thus.using.'and'.or.'o |
| 1380 | 72 27 20 77 69 74 68 20 61 6e 20 61 72 72 61 79 0a 72 65 73 75 6c 74 73 20 69 6e 20 61 6e 20 65 | r'.with.an.array.results.in.an.e |
| 13a0 | 72 72 6f 72 2e 20 54 68 65 72 65 20 61 72 65 20 74 77 6f 20 61 6c 74 65 72 6e 61 74 69 76 65 73 | rror..There.are.two.alternatives |
| 13c0 | 3a 0a 0a 20 31 29 20 75 73 65 20 74 68 65 20 75 66 75 6e 63 20 66 75 6e 63 74 69 6f 6e 73 20 6c | :...1).use.the.ufunc.functions.l |
| 13e0 | 6f 67 69 63 61 6c 5f 61 6e 64 28 29 20 61 6e 64 20 6c 6f 67 69 63 61 6c 5f 6f 72 28 29 2e 0a 20 | ogical_and().and.logical_or()... |
| 1400 | 32 29 20 75 73 65 20 74 68 65 20 62 69 74 77 69 73 65 20 6f 70 65 72 61 74 6f 72 73 20 26 20 61 | 2).use.the.bitwise.operators.&.a |
| 1420 | 6e 64 20 5c 7c 2e 20 54 68 65 20 64 72 61 77 62 61 63 6b 20 6f 66 20 74 68 65 73 65 20 69 73 20 | nd.\|..The.drawback.of.these.is. |
| 1440 | 74 68 61 74 20 69 66 0a 20 20 20 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 74 68 65 | that.if.....the.arguments.to.the |
| 1460 | 73 65 20 6f 70 65 72 61 74 6f 72 73 20 61 72 65 20 6e 6f 74 20 62 6f 6f 6c 65 61 6e 20 61 72 72 | se.operators.are.not.boolean.arr |
| 1480 | 61 79 73 2c 20 74 68 65 20 72 65 73 75 6c 74 20 69 73 0a 20 20 20 20 6c 69 6b 65 6c 79 20 69 6e | ays,.the.result.is.....likely.in |
| 14a0 | 63 6f 72 72 65 63 74 2e 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 6d 6f 73 74 | correct..On.the.other.hand,.most |
| 14c0 | 20 75 73 61 67 65 73 20 6f 66 20 6c 6f 67 69 63 61 6c 5f 61 6e 64 20 61 6e 64 0a 20 20 20 20 6c | .usages.of.logical_and.and.....l |
| 14e0 | 6f 67 69 63 61 6c 5f 6f 72 20 61 72 65 20 77 69 74 68 20 62 6f 6f 6c 65 61 6e 20 61 72 72 61 79 | ogical_or.are.with.boolean.array |
| 1500 | 73 2e 20 41 73 20 6c 6f 6e 67 20 61 73 20 6f 6e 65 20 69 73 20 63 61 72 65 66 75 6c 2c 20 74 68 | s..As.long.as.one.is.careful,.th |
| 1520 | 69 73 20 69 73 0a 20 20 20 20 61 20 63 6f 6e 76 65 6e 69 65 6e 74 20 77 61 79 20 74 6f 20 61 70 | is.is.....a.convenient.way.to.ap |
| 1540 | 70 6c 79 20 74 68 65 73 65 20 6f 70 65 72 61 74 6f 72 73 2e 0a 0a 4e 29 01 da 07 5f 5f 64 6f 63 | ply.these.operators...N)...__doc |
| 1560 | 5f 5f a9 00 f3 00 00 00 00 fa 57 2f 68 6f 6d 65 2f 62 6c 61 63 6b 68 61 6f 2f 75 69 75 63 2d 63 | __........W/home/blackhao/uiuc-c |
| 1580 | 6f 75 72 73 65 2d 67 72 61 70 68 2f 2e 76 65 6e 76 2f 6c 69 62 2f 70 79 74 68 6f 6e 33 2e 31 32 | ourse-graph/.venv/lib/python3.12 |
| 15a0 | 2f 73 69 74 65 2d 70 61 63 6b 61 67 65 73 2f 6e 75 6d 70 79 2f 64 6f 63 2f 75 66 75 6e 63 73 2e | /site-packages/numpy/doc/ufuncs. |
| 15c0 | 70 79 fa 08 3c 6d 6f 64 75 6c 65 3e 72 06 00 00 00 01 00 00 00 73 0b 00 00 00 f0 03 01 01 01 f2 | py..<module>r........s.......... |
| 15e0 | 02 49 02 01 04 72 04 00 00 00 | .I...r.... |