summaryrefslogtreecommitdiff
path: root/Master/texmf/asymptote/math.asy
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-06-09 23:27:17 +0000
committerKarl Berry <karl@freefriends.org>2010-06-09 23:27:17 +0000
commitfa8eb4b879ad12a28dfcc0fec3d229b345975b01 (patch)
tree51a9c98eae950aba97a7a1140489f4b08204b8f2 /Master/texmf/asymptote/math.asy
parentf7d3e62739d22ea35204a4a65e8e6c96bb7aaaa9 (diff)
asymptote 1.96
git-svn-id: svn://tug.org/texlive/trunk@18854 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf/asymptote/math.asy')
-rw-r--r--Master/texmf/asymptote/math.asy30
1 files changed, 30 insertions, 0 deletions
diff --git a/Master/texmf/asymptote/math.asy b/Master/texmf/asymptote/math.asy
index ff267b955d7..a684307e5a5 100644
--- a/Master/texmf/asymptote/math.asy
+++ b/Master/texmf/asymptote/math.asy
@@ -144,6 +144,36 @@ int[][] segment(bool[] b)
return segment;
}
+// If the sorted array a does not contain x, insert it sequentially,
+// returning the index of x in the resulting array.
+int unique(real[] a, real x) {
+ int i=search(a,x);
+ if(i == -1 || x != a[i]) {
+ ++i;
+ a.insert(i,x);
+ return i;
+ }
+ return i;
+}
+
+int unique(string[] a, string x) {
+ int i=search(a,x);
+ if(i == -1 || x != a[i]) {
+ ++i;
+ a.insert(i,x);
+ return i;
+ }
+ return i;
+}
+
+bool lexorder(pair a, pair b) {
+ return a.x < b.x || (a.x == b.x && a.y <= b.y);
+}
+
+bool lexorder(triple a, triple b) {
+ return a.x < b.x || (a.x == b.x && (a.y < b.y || (a.y == b.y && a.z <= b.z)));
+}
+
real[] zero(int n)
{
return sequence(new real(int) {return 0;},n);