Not Equal to: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Text replacement - "</source>" to "</syntaxhighlight>")
Tags: Mobile edit Mobile web edit
(Added Reference for Comparison Tolerance)
Line 1: Line 1:
{{Built-in|Not Equal to|<nowiki>≠</nowiki>}} is a [[comparison function]] which tests whether argument elements are [[Tolerant comparison|tolerantly]] unequal. It is the [[Not|negation]] of [[Equal to]] (<syntaxhighlight lang=apl inline>=</syntaxhighlight>). Thus it returns 0 if the [[element]]s being compared [[match]] and 1 if they do not.
{{Built-in|Not Equal to|<nowiki>≠</nowiki>}} is a [[comparison function]] which tests whether argument elements are [[tolerantly]]<ref>[[Robert Bernecky|Bernecky, Robert]]. [https://www.jsoftware.com/papers/satn23.htm "Comparison Tolerance"]. Sharp APL Technical Notes. 1977-06-10;.</ref> unequal. It is the [[Not|negation]] of [[Equal to]] (<syntaxhighlight lang=apl inline>=</syntaxhighlight>). Thus it returns 0 if the [[element]]s being compared [[match]] and 1 if they do not.
 


== Examples ==
== Examples ==
Line 26: Line 27:


== External links ==
== External links ==
== References ==
<references />


=== Documentation ===
=== Documentation ===

Revision as of 15:44, 28 November 2022

Not Equal to () is a comparison function which tests whether argument elements are tolerantly[1] unequal. It is the negation of Equal to (=). Thus it returns 0 if the elements being compared match and 1 if they do not.


Examples

See Equal to for a more detailed treatment of equality testing.

      2 2.5 3 3.5 ≠ 2.5
1 0 1 1

Boolean function

When the arguments to Not Equal to are Boolean, it is the exclusive or or xor function:

0 1
0 0 1
1 1 0

Xor is one of the most important Boolean functions because it is equivalent to addition of the arguments with modulus 2. Like addition, it is commutative and associative. It is also equivalent to subtraction with modulus 2 because the negative of a number is the same as the original number (mod 2): the negative of an odd number is still odd, and the negative of an even number is still even.

Reduction of a Boolean vector using Not Equal to yields 1 if there were an odd number of 1s in the argument and 0 otherwise. In APL, if v is a Boolean vector then ≠/v 2|+/v.

External links

References

  1. Bernecky, Robert. "Comparison Tolerance". Sharp APL Technical Notes. 1977-06-10;.

Documentation


APL built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentityStopSelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndexCartesian ProductSort
Selector Index generatorGradeIndex OfInterval IndexIndicesDealPrefix and suffix vectors
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-BeamSpawnFunction axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)
Quad names Index originComparison toleranceMigration levelAtomic vector