Naming Conventions |
|||||
|
Scalar |
Vector |
Matrix |
Any |
Non- |
Boolean |
BS |
BV |
BM |
BA |
BN |
Integer |
IS |
IV |
IM |
IA |
IN |
Float |
FS |
FV |
FM |
FA |
FN |
Numeric |
NS |
NV |
NM |
NA |
NN |
Character |
CS |
CV |
CM |
CA |
CN |
Enclosed |
ES |
EV |
EM |
EA |
EN |
enclosed |
TS |
TV |
TM |
TA |
TN |
Simple |
SS |
SV |
SM |
SA |
SN |
Any |
AS |
AV |
AM |
AA |
AN |
phrase e.g.: .X...Y. ⍝ X←BS; Y←IV |
|||||
combinations: use ISV for Integer scalar∨vector |
|||||
B3, I4 &c. to specify higher ranks. |
|||||
FindRowsInMatrix
Returns an integer vector reporting how many times each row in AM1 is found in AM2:
+/AM1^.=⍉AM2
Every row in AM1 is supposed to be unique. The number of columns in both matrices must be the same.
Examples
⎕FX ⍕2 1⍴'r←AM1 FindRowsInMatrix AM2' 'r←+/AM1^.=⍉AM2'
AM1←⊃'Barak Obama' 'George Bush' 'Bill Clinton' 'Ronald Reagan' 'Gerald Ford' 'John Kennedy'
AM2←AM1[2 2 5;]
AM1 FindRowsInMatrix AM2
0 0 2 0 0 1
Compatibility
Checked with: APLX, NARS2000, Dyalog
Remarks
You might want to make sure that a vector provided as right argument is automatically turned into a matrix. You can do so by making use of the phrase EnforceMatrix.
Test Cases
Show test cases
Test my code, both Examples and Test Cases.
See also: FindRowInMatrix
Mentor: KaiJaeger
APL Wiki