Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1013510 // ai_relationSymmetryCount - returns Rat(symmetryCount, totalCount)

JavaX fragment (include)

static Rat ai_relationSymmetryCount(S rel) {
  L<TripleWeb> l = triplesWithB(rel);
  new Set<Pair<S>> pairs;
  int i = 0, n = 0;
  for (TripleWeb w : l)
    pairs.add(stdCasePair(w.a, w.b));
  for (TripleWeb w : l) {
    ++n;
    if (pairs.contains(stdCasePair(w.b, w.a)))
      ++i;
  }
  print("l(l)=" + l(l) + ", i=" + i +", n=" + n);
  ret rat_noSimplify(i, n);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013510
Snippet name: ai_relationSymmetryCount - returns Rat(symmetryCount, totalCount)
Eternal ID of this version: #1013510/4
Text MD5: a81773bd0aefdf3f051b728a27e1d614
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-08 01:57:54
Source code size: 380 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 378 / 397
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)