[genius] Wed Oct 24 20:33:24 2018 Jiri (George) Lebl <jirka 5z com>
- From: Jiri (George) Lebl <jirka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [genius] Wed Oct 24 20:33:24 2018 Jiri (George) Lebl <jirka 5z com>
- Date: Thu, 25 Oct 2018 01:33:40 +0000 (UTC)
commit 0704c3429c8e796537222fba938931abe336371a
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date: Wed Oct 24 20:33:26 2018 -0500
Wed Oct 24 20:33:24 2018 Jiri (George) Lebl <jirka 5z com>
* lib/linear_algebra/misc.gel: optimize the Make(Row)Vector functions
in case of vector input.
* src/geniustests.txt: Add a bunch of tests
ChangeLog | 7 +++++++
lib/linear_algebra/misc.gel | 8 ++++++--
src/geniustests.txt | 27 +++++++++++++++++++++++++++
3 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fba4351b..508c293e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Oct 24 20:33:24 2018 Jiri (George) Lebl <jirka 5z com>
+
+ * lib/linear_algebra/misc.gel: optimize the Make(Row)Vector functions
+ in case of vector input.
+
+ * src/geniustests.txt: Add a bunch of tests
+
Wed Oct 24 13:38:31 2018 Jiri (George) Lebl <jirka 5z com>
* src/funclib.c, src/funclibhelper.cP: Add AppendVector, plus a few
diff --git a/lib/linear_algebra/misc.gel b/lib/linear_algebra/misc.gel
index 1aea93ff..cd7ec6a0 100644
--- a/lib/linear_algebra/misc.gel
+++ b/lib/linear_algebra/misc.gel
@@ -345,7 +345,9 @@ function MakeVector(A) = (
else if not IsMatrix(A) then
(error("MakeVector: argument not a matrix");bailout)
else if columns(A) == 1 then
- return A;
+ return A
+ else if rows(A) == 1 then
+ return A.';
r = null;
for k=1 to columns(A) do (
r = [r;A@(,k)]
@@ -361,7 +363,9 @@ function MakeRowVector(A) = (
else if not IsMatrix(A) then
(error("MakeRowVector: argument not a matrix");bailout)
else if rows(A) == 1 then
- return A;
+ return A
+ else if columns(A) == 1 then
+ return A.';
r = null;
for k=1 to rows(A) do (
r = [r,A@(k,)]
diff --git a/src/geniustests.txt b/src/geniustests.txt
index d898a8d6..06244f58 100644
--- a/src/geniustests.txt
+++ b/src/geniustests.txt
@@ -19,6 +19,7 @@ if 66 then 4 else 5 4
if 0 then 4 else 5 5
a=1 1
a=1;a 1
+a=1;b=a;a=2;b 1
a=2;a=a+1;a 3
a=1;b=&a;b (&a)
a=1;b=&a;c=b;c (&a)
@@ -229,6 +230,10 @@ prime(10) 29
MaxDigits=12;exp(3*ln(2)) 8.0
if(0)then 1;0 0
24/2 12
+a@(3)=3;a [0,0,3]
+a=null;a@(3)=3;a [0,0,3]
+a=[1;2;5];a@(3)=3;a [1;2;3]
+a=[1;2;5];a@(5)=3;a [1;2;5;0;3]
a@(1,2)=3;a [0,3]
a@(1,2)=3;a@(3)=9;a [0,3,9]
a@(2,1)=3;a=a.';a@(3)=9;a [0,3,9]
@@ -1287,17 +1292,36 @@ Im(4) 0
0.00000000000000000000000000000000000001+1.1i 0.0+1.1i
-0.00000000000000000000000000000000000001+1.1i -0.0+1.1i
Subfactorial([1,2,3,4,5,6]) [0,1,2,9,44,265]
+Subfactorial([1;2;3]) [0;1;2]
Subfactorial(0) 1
Subfactorial(-1) Subfactorial(-1)
Factorial([0,1,2,3,4,5,6]) [1,1,2,6,24,120,720]
DoubleFactorial([0,1,2,3,4,5,6]) [1,1,2,3,8,15,48]
+DoubleFactorial(-1) DoubleFactorial(-1)
StripZeroColumns(zeros(4,4))+0 ((null)+0)
Image(zeros(4,4))+0 ((null)+0)
+rows(null) 0
+rows(1) rows(1)
+rows([1,2]) 1
+rows(`[1,[1;2]]) 1
+rows(`[1;[1;2]]) 2
+rows([1;2]) 2
+rows([1,3,1;2,8,2]) 2
+columns(null) 0
+columns(1) columns(1)
+columns([1,2]) 2
+columns(`[1,[1,2]]) 2
+columns(`[1;[1,2]]) 1
+columns([1;2]) 1
+columns([1,3,1;2,8,2]) 3
elements(null) 0
+elements(1) elements(1)
elements([1,2]) 2
elements(`[1,[1,2]]) 2
+elements([1;[1,2]]) 4
elements([1;2]) 2
elements([1,3;2,8]) 4
+elements([1,3,1;2,8]) 6
v=[1,2,3];w=AppendElement(v,5) [1,2,3,5]
v=[1;2;3];w=AppendElement(v,5) [1;2;3;5]
v=[1];w=AppendElement(v,5) [1,5]
@@ -1305,6 +1329,9 @@ v=null;w=AppendElement(v,5) [5]
v=[1,2,3];w=AppendElement(v,5);v [1,2,3]
v=[1,2,3];w=AppendElement(v,v) [1,2,3,[1,2,3]]
v=[1,2,3];w=AppendElement(v,v);v [1,2,3]
+AppendElement(null,null) [(null)]
+AppendElement([1,2,3],null) [1,2,3,(null)]
+AppendElement(1,1) AppendElement(1,1)
load "nullspacetest.gel" true
load "longtest.gel" true
load "testprec.gel" true
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]