mathlib-commitlog Mailing List for JMathLib - Octave, Matlab clone in java (Page 46)
Status: Beta
Brought to you by:
st_mueller
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(4) |
Aug
(150) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(233) |
Feb
(86) |
Mar
(32) |
Apr
(26) |
May
(73) |
Jun
(45) |
Jul
(23) |
Aug
(23) |
Sep
(5) |
Oct
(80) |
Nov
(11) |
Dec
(11) |
| 2008 |
Jan
|
Feb
|
Mar
(13) |
Apr
(3) |
May
(7) |
Jun
(30) |
Jul
(12) |
Aug
(12) |
Sep
|
Oct
|
Nov
(78) |
Dec
(78) |
| 2009 |
Jan
(214) |
Feb
(79) |
Mar
(20) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Stefan M. <st_...@us...> - 2007-01-08 19:09:28
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20221/Source/MathLib/Tokens Modified Files: NumberToken.java Log Message: better support for ND-array and simple operations (e.g. sin, cos...) Index: NumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/NumberToken.java,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** NumberToken.java 8 Jan 2007 18:47:34 -0000 1.97 --- NumberToken.java 8 Jan 2007 19:09:20 -0000 1.98 *************** *** 1511,1516 **** public OperandToken sin() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1511,1515 ---- public OperandToken sin() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 1561,1566 **** public OperandToken cos() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1560,1564 ---- public OperandToken cos() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 1611,1616 **** public OperandToken tan() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1609,1613 ---- public OperandToken tan() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 1638,1643 **** public OperandToken asin() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1635,1639 ---- public OperandToken asin() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 1684,1689 **** public OperandToken acos() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1680,1684 ---- public OperandToken acos() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 1735,1740 **** public OperandToken atan() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1730,1734 ---- public OperandToken atan() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 1781,1786 **** public OperandToken sinh() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1775,1779 ---- public OperandToken sinh() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 1826,1831 **** public OperandToken cosh() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1819,1823 ---- public OperandToken cosh() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 1871,1876 **** public OperandToken tanh() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1863,1867 ---- public OperandToken tanh() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 1900,1905 **** public OperandToken asinh() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1891,1895 ---- public OperandToken asinh() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 1940,1945 **** public OperandToken acosh() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1930,1934 ---- public OperandToken acosh() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 1982,1987 **** public OperandToken atanh() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 1971,1975 ---- public OperandToken atanh() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 2026,2031 **** public OperandToken exp() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 2014,2018 ---- public OperandToken exp() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 2052,2057 **** public OperandToken ln() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 2039,2043 ---- public OperandToken ln() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 2066,2071 **** public OperandToken log() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 2052,2056 ---- public OperandToken log() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 2095,2100 **** public OperandToken sqrt() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 2080,2084 ---- public OperandToken sqrt() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 2199,2204 **** public OperandToken floor() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 2183,2187 ---- public OperandToken floor() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 2215,2220 **** public OperandToken ceil() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 2198,2202 ---- public OperandToken ceil() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 2231,2236 **** public OperandToken round() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 2213,2217 ---- public OperandToken round() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 2246,2251 **** public OperandToken negate() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 2227,2231 ---- public OperandToken negate() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 2284,2289 **** public OperandToken factorial() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 2264,2268 ---- public OperandToken factorial() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) *************** *** 2315,2320 **** public OperandToken conjugate() { ! NumberToken result = new NumberToken(); ! result.setSize(sizeY, sizeX); for(int n = 0; n < noElem; n++) --- 2294,2298 ---- public OperandToken conjugate() { ! NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) |
|
From: Stefan M. <st_...@us...> - 2007-01-08 18:59:15
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv15839/Source/MathLib/Functions/General Modified Files: rand.java Log Message: Index: rand.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/rand.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** rand.java 8 Jan 2007 18:47:33 -0000 1.11 --- rand.java 8 Jan 2007 18:59:05 -0000 1.12 *************** *** 16,29 **** throwMathLibException("rand: number of arguments <1 "); - // first operand must be a number - //if (!(operands[0] instanceof NumberToken)) - // throwMathLibException("rand: arguments must be numbers"); - - // get data from arguments - //int y = (int)((NumberToken)operands[0]).getValueRe(0); - //int x = y; // square argument: e.g. rand( 5 ) = rand( 5, 5) - // number of arguments ! int n = getNArgIn(operands); int[] dim = new int[n]; --- 16,23 ---- throwMathLibException("rand: number of arguments <1 "); // number of arguments ! int n = getNArgIn(operands); ! ! // set up dimension array int[] dim = new int[n]; *************** *** 35,40 **** throwMathLibException("rand: arguments must be numbers"); dim[i] = (int)((NumberToken)operands[i]).getValueRe(0); - } --- 29,34 ---- throwMathLibException("rand: arguments must be numbers"); + // get requested dimension dim[i] = (int)((NumberToken)operands[i]).getValueRe(0); } |
|
From: Stefan M. <st_...@us...> - 2007-01-08 18:56:59
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv14882/Source/MathLib/Functions/General Modified Files: whos.java Log Message: added better support for ND-arrays Index: whos.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/whos.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** whos.java 8 Jan 2007 18:47:34 -0000 1.5 --- whos.java 8 Jan 2007 18:56:55 -0000 1.6 *************** *** 29,46 **** if (op instanceof NumberToken) { ! NumberToken num = (NumberToken)op; ! int[] s = num.getSize(); ! for (int i=0; i< s.length; i++) ! { ! line += s[i]; ! if (i<s.length-1) ! line +="x"; ! } line +=" \t double "; } else if (op instanceof CharToken) { ! CharToken str = (CharToken)op; ! line += str.getSizeY()+"x"+str.getSizeX()+" \t char"; } else if (op instanceof MatrixToken) --- 29,39 ---- if (op instanceof NumberToken) { ! line += getSizeString(op); line +=" \t double "; } else if (op instanceof CharToken) { ! line += getSizeString(op); ! line += " \t char"; } else if (op instanceof MatrixToken) *************** *** 50,55 **** else if (op instanceof CellArrayToken) { ! CellArrayToken cell = (CellArrayToken)op; ! line += cell.getSizeY()+"x"+cell.getSizeX()+" \t cell "; } else --- 43,48 ---- else if (op instanceof CellArrayToken) { ! line += getSizeString(op); ! line += " \t cell "; } else *************** *** 63,66 **** --- 56,76 ---- return null; } + + private String getSizeString(OperandToken tok) + { + int[] s = ((DataToken)tok).getSize(); + + String line =""; + + for (int i=0; i< s.length; i++) + { + line += s[i]; + if (i<s.length-1) + line +="x"; + } + + return line; + } + } |
|
From: Stefan M. <st_...@us...> - 2007-01-08 18:50:30
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv12353 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** ChangeLog.txt 6 Jan 2007 15:03:33 -0000 1.141 --- ChangeLog.txt 8 Jan 2007 18:50:27 -0000 1.142 *************** *** 25,29 **** Updated functions: ! col.m, diag.java, imag.java, real.java, row.m, size.java, tic.java --- 25,30 ---- Updated functions: ! col.m, diag.java, ndims.java, imag.java, rand.java, real.java, row.m, ! size.java, tic.java *************** *** 32,35 **** --- 33,40 ---- stefan * + 2007/01/08 + stefan * NumberToken.java, CellArrayToken.java, DataToken.java, ndims.java, + size.java, rand.java added (better) support for ND-arrays. + 2007/01/06 stefan * NumberToken.java ... Reorganized NumberToken. Elements are now stored |
|
From: Stefan M. <st_...@us...> - 2007-01-08 18:48:30
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv11509/Source/MathLib/Functions/General Modified Files: ndims.java Log Message: added better support for ND-arrays Index: ndims.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/ndims.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ndims.java 30 Dec 2006 17:39:59 -0000 1.5 --- ndims.java 8 Jan 2007 18:48:24 -0000 1.6 *************** *** 23,37 **** throwMathLibException("ndims: works only on numbers"); ! // get data from arguments ! double[][] x = ((NumberToken)operands[0]).getReValues(); ! ! int sizeX = x.length; ! int sizeY = x[0].length; ! ! if ((sizeX>=1) && (sizeY>=1)) ! return new NumberToken(2.0); ! else ! return new NumberToken(1.0); ! } // end eval } --- 23,31 ---- throwMathLibException("ndims: works only on numbers"); ! // get size vector -> length of size vector is number of dimensions ! int n = ((NumberToken)operands[0]).getSize().length; ! ! return new NumberToken(n); ! } // end eval } *************** *** 47,51 **** @EXAMPLES <programlisting> ! . </programlisting> @NOTES --- 41,49 ---- @EXAMPLES <programlisting> ! a=rand(5,5); ! ndims(a) -> 2 ! ! a=rand(5,5,5) ! ndims(a) -> 3 </programlisting> @NOTES |
|
From: Stefan M. <st_...@us...> - 2007-01-08 18:47:53
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv11020/Source/MathLib/Tools/TestSuite/Functions/General Modified Files: testSize.java Log Message: added better support for ND-arrays Index: testSize.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Functions/General/testSize.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testSize.java 15 Jul 2006 15:57:08 -0000 1.3 --- testSize.java 8 Jan 2007 18:47:34 -0000 1.4 *************** *** 1,4 **** --- 1,5 ---- package MathLib.Tools.TestSuite.Functions.General; + import MathLib.Tools.TestSuite.Compare; import MathLib.Tools.junit.framework.*; import MathLib.Interpreter.*; *************** *** 70,72 **** --- 71,85 ---- } + public void testSize100() { + double[][] s = {{3.0, 3.0, 5.0}}; + ml.executeExpression("z = size(rand(3,3,5))"); + assertTrue(Compare.ArrayEquals(s, ml.getArrayValueRe("z"))); + } + + public void testSize101() { + double[][] s = {{3.0, 3.0, 5.0, 1.0, 3.0}}; + ml.executeExpression("z = size( rand(3,3,5,1,3) )"); + assertTrue(Compare.ArrayEquals(s, ml.getArrayValueRe("z"))); + } + } |
|
From: Stefan M. <st_...@us...> - 2007-01-08 18:47:48
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv11020/Source/MathLib/Functions/General Modified Files: rand.java size.java whos.java Log Message: added better support for ND-arrays Index: rand.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/rand.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** rand.java 26 Dec 2006 16:22:47 -0000 1.10 --- rand.java 8 Jan 2007 18:47:33 -0000 1.11 *************** *** 13,54 **** // at least one operand ! if ((getNArgIn(operands) < 1) || ! (getNArgIn(operands) > 2) ) ! throwMathLibException("rand: number of arguments 1 or 2"); // first operand must be a number ! if (!(operands[0] instanceof NumberToken)) ! throwMathLibException("rand: arguments must be numbers"); // get data from arguments ! int y = (int)((NumberToken)operands[0]).getReValues()[0][0]; ! int x = y; // square argument: e.g. rand( 5 ) = rand( 5, 5) ! ! // check for second argument ! if (operands.length == 2) ! { ! if (operands[1] instanceof NumberToken) ! { ! // two arguments: rand( number, number) ! x = (int)((NumberToken)operands[1]).getReValues()[0][0]; ! } ! else return null; ! } ! // only valid for indeces >0 ! if ((x<=0) || (y<=0)) ! return null; - // create random matrix - double[][] values = new double[y][x]; - for (int xi=0; xi<x ; xi++) - { - for (int yi=0; yi<y ; yi++) - { - values[yi][xi] = Math.random(); - } - } - - return new NumberToken(values); } } --- 13,60 ---- // at least one operand ! if (getNArgIn(operands) < 1) ! throwMathLibException("rand: number of arguments <1 "); // first operand must be a number ! //if (!(operands[0] instanceof NumberToken)) ! // throwMathLibException("rand: arguments must be numbers"); // get data from arguments ! //int y = (int)((NumberToken)operands[0]).getValueRe(0); ! //int x = y; // square argument: e.g. rand( 5 ) = rand( 5, 5) ! // number of arguments ! int n = getNArgIn(operands); ! int[] dim = new int[n]; ! ! // only NumberTokens accepted ! // each token is one dimension ! for (int i=0; i<n; i++) ! { ! if (!(operands[i] instanceof NumberToken)) ! throwMathLibException("rand: arguments must be numbers"); ! ! dim[i] = (int)((NumberToken)operands[i]).getValueRe(0); ! ! } ! ! // special case for rand(k) -> rand(k,k) ! if (dim.length==1) ! { ! int d = dim[0]; ! dim = new int[]{d,d}; ! } ! ! // ceate array of correct size with dimensions "dim" ! NumberToken num = new NumberToken(dim, null, null); ! ! // create random value for all values of num ! for (int i=0; i< num.getNumberOfElements(); i++) ! { ! num.setValue(i, Math.random(), 0); ! } ! ! return num; } } *************** *** 58,66 **** general @SYNTAX ! matrix = RAND(size) @DOC Returns a matrix filled with random numbers. @EXAMPLES ! RAND(3) = [0.34, 0.45, 0.55] @NOTES @SEE --- 64,74 ---- general @SYNTAX ! matrix = rand(size) ! matrix = rand(x,y,....) @DOC Returns a matrix filled with random numbers. @EXAMPLES ! rand(3,2) = [0.34, 0.45, 0.55 ! 0.22, 0.33, 0.72] @NOTES @SEE Index: size.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/size.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** size.java 24 Nov 2006 21:18:33 -0000 1.8 --- size.java 8 Jan 2007 18:47:34 -0000 1.9 *************** *** 22,34 **** throwMathLibException("size: argument must be a data token"); ! // get size or argument ! int y = (int)((DataToken)operands[0]).getSizeY(); ! int x = (int)((DataToken)operands[0]).getSizeX(); ! ! // e.g. size(A) if (getNArgIn(operands)==1) { ! double[][] values = {{(double)y, (double)x}}; ! return new NumberToken(values); } --- 22,38 ---- throwMathLibException("size: argument must be a data token"); ! // get size array (e.g. [2,3,1] for 2x3x1 array ! int[] size = ((DataToken)operands[0]).getSize(); ! ! // e.g. size(A) -> [2,3,2] if (getNArgIn(operands)==1) { ! double[][] values = new double[1][size.length]; ! ! // copy size vector to return value ! for (int i=0; i<size.length; i++) ! values[0][i] = (double)size[i]; ! ! // return vector of sizes return new NumberToken(values); } *************** *** 37,53 **** // e.g. size([1,2,3],1) -> 1 // e.g. size([1,2,3],2) -> 3 ! // second operand must be a number if (!(operands[1] instanceof NumberToken)) throwMathLibException("size: second argument must be a number token"); ! int n = (int)((NumberToken)operands[1]).getValueRe(0, 0); ! if (n==1) ! return new NumberToken(y); ! else if (n==2) ! return new NumberToken(x); ! else throwMathLibException("size: dimension not supported"); ! ! return null; } --- 41,57 ---- // e.g. size([1,2,3],1) -> 1 // e.g. size([1,2,3],2) -> 3 ! // second operand must also be a number if (!(operands[1] instanceof NumberToken)) throwMathLibException("size: second argument must be a number token"); ! // retrieve requested dimension ! int n = (int)((NumberToken)operands[1]).getValueRe(0); ! ! // check index of dimension vector ! if ((n<1) || (n>size.length)) throwMathLibException("size: dimension not supported"); ! ! // return one element from size vector ! return new NumberToken(size[n-1]); } *************** *** 58,70 **** general @SYNTAX ! [sizey, sizex] = SIZE(matrix) @DOC returns the size of a matrix. @EXAMPLES ! SIZE([1,2;3,4]) = [2,2] ! SIZE([1,2,3;4,5,6]) = [2,3] @NOTES @SEE ! rowcount, colcount, row, col */ --- 62,82 ---- general @SYNTAX ! [y, x] = size(matrix) ! z = size(matrix, n) @DOC returns the size of a matrix. @EXAMPLES ! <programlisting> ! size([1,2;3,4]) = [2,2] ! size([1,2,3;4,5,6]) = [2,3] ! ! a=rand(4,4,2) ! size(a) -> [4,4,2) ! ! size(a,3) -> 2 ! </programlisting> @NOTES @SEE ! rowcount, colcount, row, col, ndims */ Index: whos.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/whos.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** whos.java 19 Nov 2006 16:07:07 -0000 1.4 --- whos.java 8 Jan 2007 18:47:34 -0000 1.5 *************** *** 30,34 **** { NumberToken num = (NumberToken)op; ! line += num.getSizeY()+"x"+num.getSizeX()+" \t double "; } else if (op instanceof CharToken) --- 30,41 ---- { NumberToken num = (NumberToken)op; ! int[] s = num.getSize(); ! for (int i=0; i< s.length; i++) ! { ! line += s[i]; ! if (i<s.length-1) ! line +="x"; ! } ! line +=" \t double "; } else if (op instanceof CharToken) |
|
From: Stefan M. <st_...@us...> - 2007-01-08 18:47:45
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv11020/Source/MathLib/Tokens Modified Files: NumberToken.java CellArrayToken.java Log Message: added better support for ND-arrays Index: NumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/NumberToken.java,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** NumberToken.java 8 Jan 2007 16:20:44 -0000 1.96 --- NumberToken.java 8 Jan 2007 18:47:34 -0000 1.97 *************** *** 277,282 **** public int index2n(int[] index) { for (int i=0; i<index.length; i++) ! ErrorLogger.debugLine("NumberToken: index2n: index: "+index[i]); int dn = noElem; --- 277,285 ---- public int index2n(int[] index) { + String s=""; for (int i=0; i<index.length; i++) ! s += index[i]+" "; ! ! ErrorLogger.debugLine("NumberToken: index2n: index: "+s); int dn = noElem; *************** *** 286,290 **** { dn = dn / sizeA[i]; ! n += dn * (index[i]-1); } --- 289,293 ---- { dn = dn / sizeA[i]; ! n += dn * index[i]; } *************** *** 650,654 **** for (int k=2; k<dim.length; k++) { ! ret += "," + dim[k]; } ret += ") = \n"; --- 653,657 ---- for (int k=2; k<dim.length; k++) { ! ret += "," + (dim[k]+1); //NOTE: conversion from internal to external index } ret += ") = \n"; *************** *** 665,682 **** StringBuffer buffer = new StringBuffer(20); ! int sizeY = nn[0]; ! int sizeX = nn[1]; ! ! for(int yy = 0; yy < sizeY; yy++) { ! buffer.append("["); ! for(int xx = 0; xx < sizeX; xx++) { ! int n = yx2n(yy,xx); //!!! buffer.append(toString(values[n])); if(xx < sizeX - 1) ! buffer.append(" , "); } buffer.append("]\n"); --- 668,685 ---- StringBuffer buffer = new StringBuffer(20); ! for(int yy = 0; yy < sizeA[0]; yy++) { ! buffer.append(" ["); ! for(int xx = 0; xx < sizeA[1]; xx++) { ! nn[0] = yy; ! nn[1] = xx; ! int n = index2n(nn); ! ErrorLogger.debugLine(" NToken: "+index2n(nn)); buffer.append(toString(values[n])); if(xx < sizeX - 1) ! buffer.append(" , "); } buffer.append("]\n"); Index: CellArrayToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/CellArrayToken.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CellArrayToken.java 17 Oct 2006 18:10:21 -0000 1.8 --- CellArrayToken.java 8 Jan 2007 18:47:34 -0000 1.9 *************** *** 17,20 **** --- 17,22 ---- sizeY = 0; sizeX = 0; + sizeA = null; + noElem = 0; values = null; } *************** *** 27,30 **** --- 29,34 ---- sizeY = _values.length; sizeX = _values[0].length; + sizeA = new int[]{sizeY, sizeX}; + noElem = sizeY * sizeX; values = _values; } *************** *** 35,42 **** { super(5); //, "CELL"); values = new OperandToken[1][1]; values[0][0] = _value; - sizeY = 1; - sizeX = 1; } --- 39,48 ---- { super(5); //, "CELL"); + sizeY = 1; + sizeX = 1; + sizeA = new int[]{sizeY, sizeX}; + noElem = sizeY * sizeX; values = new OperandToken[1][1]; values[0][0] = _value; } |
|
From: Stefan M. <st_...@us...> - 2007-01-08 16:20:56
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv9009/Source/MathLib/Tokens Modified Files: DataToken.java NumberToken.java CharToken.java Log Message: added preliminary support for ND-arrays Index: NumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/NumberToken.java,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** NumberToken.java 7 Jan 2007 15:42:46 -0000 1.95 --- NumberToken.java 8 Jan 2007 16:20:44 -0000 1.96 *************** *** 331,334 **** --- 331,335 ---- sizeY = dy; sizeX = dx; + sizeA = new int[]{sizeY, sizeX}; noElem = sizeY * sizeX; } // end setSize *************** *** 597,627 **** if((sizeY == 0) && (sizeX == 0)) { result = "[]"; } ! else if((sizeY == 1) && (sizeX == 1)) { result = toString(values[0]); } else { ! StringBuffer buffer = new StringBuffer(20); ! for(int yy = 0; yy < sizeY; yy++) ! { ! buffer.append("["); ! for(int xx = 0; xx < sizeX; xx++) ! { ! int n = yx2n(yy,xx); ! buffer.append(toString(values[n])); ! ! if(xx < sizeX - 1) ! buffer.append(" , "); ! } ! buffer.append("]\n"); ! } ! result = new String(buffer); } return result; } /** create string representation of (complex) double values @param _values[]={REAL,IMAG} real and imaginary part of number*/ --- 598,688 ---- if((sizeY == 0) && (sizeX == 0)) { + // e.g. a=null; result = "[]"; } ! else if((sizeY == 1) && (sizeX == 1) && sizeA.length==2) { + // e.g. a=555; result = toString(values[0]); } + else if (sizeA.length ==2) + { + result = toString2d(new int[]{sizeY,sizeX}); + } else { ! // e.g. a=[1,2,3;4,5,6] or multidimensional ! ! int[] dim = new int[sizeA.length]; ! dim[0] = sizeY; ! dim[1] = sizeX; ! ! String s = toString(dim, sizeA.length-1); ! ! result = new String(s); } return result; } + + private String toString(int[] dim, int i) + { + String ret=""; + + if (i>=2) + { + // e.g. at least 3rd dimension + // e.g. a(5,3,4,x,3,1) + for (int n=0; n<sizeA[i]; n++) + { + dim[i]=n; + + + // e.g. a(5,3,Y,x,3,1) + ret += toString(dim, i-1); + + } + + } + else + { + // e.g. + ret += "(:,:"; + for (int k=2; k<dim.length; k++) + { + ret += "," + dim[k]; + } + ret += ") = \n"; + ret += toString2d(dim); + + ret += "\n"; + } + return ret; + } + + private String toString2d(int[] nn) + { + StringBuffer buffer = new StringBuffer(20); + + int sizeY = nn[0]; + int sizeX = nn[1]; + + for(int yy = 0; yy < sizeY; yy++) + { + buffer.append("["); + for(int xx = 0; xx < sizeX; xx++) + { + int n = yx2n(yy,xx); //!!! + + buffer.append(toString(values[n])); + + if(xx < sizeX - 1) + buffer.append(" , "); + } + buffer.append("]\n"); + } + return buffer.toString(); + } + /** create string representation of (complex) double values @param _values[]={REAL,IMAG} real and imaginary part of number*/ Index: CharToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/CharToken.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CharToken.java 19 Nov 2006 16:23:02 -0000 1.1 --- CharToken.java 8 Jan 2007 16:20:45 -0000 1.2 *************** *** 19,22 **** --- 19,24 ---- sizeY = 1; sizeX = values[0].length; + sizeA = new int[]{sizeY,sizeX}; + noElem = sizeY * sizeX; } *************** *** 29,32 **** --- 31,36 ---- sizeY = values.length; sizeX = values[0].length; + sizeA = new int[]{sizeY,sizeX}; + noElem = sizeY * sizeX; } *************** *** 40,43 **** --- 44,49 ---- sizeY = 1; sizeX = 1; + sizeA = new int[]{sizeY,sizeX}; + noElem = sizeY * sizeX; } Index: DataToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/DataToken.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** DataToken.java 7 Jan 2007 15:42:46 -0000 1.15 --- DataToken.java 8 Jan 2007 16:20:44 -0000 1.16 *************** *** 45,49 **** return sizeY; } ! /** * --- 45,58 ---- return sizeY; } ! ! /** ! * ! * @return ! */ ! public int[] getSize() ! { ! return sizeA; ! } ! /** * |
|
From: Stefan M. <st_...@us...> - 2007-01-07 19:32:04
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv1494/Source/MathLib/Tokens Modified Files: Expression.java Log Message: clean up and removal of unused methods Index: Expression.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/Expression.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** Expression.java 14 Jul 2006 19:41:08 -0000 1.51 --- Expression.java 7 Jan 2007 19:31:57 -0000 1.52 *************** *** 353,387 **** } /**Performs a multiplication @param argument = the value to multiply the expression by @return the result as an OperandToken*/ ! public OperandToken multiply(OperandToken argument) { return null; } ! /**Raise this object to the power of arg @param = the value to raise it to the power of @return the result as an OperandToken*/ ! public OperandToken powerOf(OperandToken argument) { return null; ! } /**add this token to another @param arg = the amount to add to it @return the result as an OperandToken*/ ! public OperandToken add(OperandToken argument) { return null; } /**subtract this token from another @param arg = the amount to subtract from it @return the result as an OperandToken*/ ! public OperandToken subtract(OperandToken argument) { return null; ! } /**Builds an expression tree --- 353,389 ---- } + /**Performs a multiplication @param argument = the value to multiply the expression by @return the result as an OperandToken*/ ! /*public OperandToken multiply(OperandToken argument) { return null; } ! */ /**Raise this object to the power of arg @param = the value to raise it to the power of @return the result as an OperandToken*/ ! /*public OperandToken powerOf(OperandToken argument) { return null; ! }*/ /**add this token to another @param arg = the amount to add to it @return the result as an OperandToken*/ ! /*public OperandToken add(OperandToken argument) { return null; } + */ /**subtract this token from another @param arg = the amount to subtract from it @return the result as an OperandToken*/ ! /*public OperandToken subtract(OperandToken argument) { return null; ! }*/ /**Builds an expression tree *************** *** 400,511 **** } - /**trigonometric functions - calculate the sine of this token - @return the result as an OperandToken*/ - //public OperandToken sin() - //{ - // return data.sin(children); - //} - - /**trigonometric functions - calculate the cosine of this token - @return the result as an OperandToken*/ - //public OperandToken cos() - //{ - // return data.cos(children); - //} - - /**trigonometric functions - calculate the tangent of this token - @return the result as an OperandToken*/ - //public OperandToken tan() - //{ - // return data.tan(children); - //} - - /**trigonometric functions - calculate the arc sine of this token - @return the result as an OperandToken*/ - //public OperandToken asin() - //{ - // return data.asin(children); - //} - - /**trigonometric functions - calculate the arc cosine of this token - @return the result as an OperandToken*/ - //public OperandToken acos() - //{ - // return data.acos(children); - //} - - /**trigonometric functions - calculate the arc tangent of this token - @return the result as an OperandToken*/ - //public OperandToken atan() - //{ - // return data.atan(children); - //} - - /**Standard functions - calculates the absolute value - @return the result as an OperandToken*/ - //public OperandToken abs() - //{ - // return data.abs(children); - //} - - /**Standard functions - calculates the exponent - @return the result as an OperandToken*/ - //public OperandToken exp() - //{ - // return data.exp(children); - //} - - /**Standard functions - calculates the natural logarythm - @return the result as an OperandToken*/ - //public OperandToken ln() - //{ - // return data.ln(children); - //} - - /**Standard functions - calculates the logarythm - @return the result as an OperandToken*/ - //public OperandToken log(RootObject arg) - //{ - // return data.log(children, arg); - //} - - /**Standard functions - calculates the square root - @return the result as an OperandToken*/ - //public OperandToken sqrt() - //{ - // return data.sqrt(children); - //} - - /**Standard functions - rounds the value down - @return the result as an OperandToken*/ - //public OperandToken floor() - //{ - // return data.floor(children); - //} - - /**Standard functions - rounds the value up - @return the result as an OperandToken*/ - //public OperandToken ceil() - //{ - // return data.ceil(children); - //} - - /**Standard functions - rounds the value to the nearest integer - @return the result as an OperandToken*/ - //public OperandToken round() - //{ - // return data.round(children); - //} - - public OperandToken derivative(String deriveBy) - { - return children[0].derivative(deriveBy); - } - - public OperandToken integral(String integrateBy) - { - return children[0].integral(integrateBy); - } - /**Checks if this operand is a numeric value @return true if this is a number, false if it's --- 402,405 ---- |
|
From: Stefan M. <st_...@us...> - 2007-01-07 15:49:41
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv5828/Source/MathLib/Functions/General Modified Files: angle.java Log Message: Index: angle.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/angle.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** angle.java 27 Dec 2006 18:31:03 -0000 1.1 --- angle.java 7 Jan 2007 15:49:38 -0000 1.2 *************** *** 16,21 **** // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getReValues(); ! double[][] a_i = ((NumberToken)operands[0]).getImValues(); int dy = ((NumberToken)operands[0]).getSizeY(); int dx = ((NumberToken)operands[0]).getSizeX(); --- 16,21 ---- // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getValuesRe(); ! double[][] a_i = ((NumberToken)operands[0]).getValuesIm(); int dy = ((NumberToken)operands[0]).getSizeY(); int dx = ((NumberToken)operands[0]).getSizeX(); |
|
From: Stefan M. <st_...@us...> - 2007-01-07 15:49:16
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv5775/Source/MathLib/Functions/General Modified Files: imag.java fix.java Log Message: Index: imag.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/imag.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** imag.java 27 Dec 2006 18:31:03 -0000 1.1 --- imag.java 7 Jan 2007 15:49:11 -0000 1.2 *************** *** 16,20 **** // get data from arguments ! double[][] a_i = ((NumberToken)operands[0]).getImValues(); return new NumberToken(a_i); --- 16,20 ---- // get data from arguments ! double[][] a_i = ((NumberToken)operands[0]).getValuesIm(); return new NumberToken(a_i); Index: fix.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/fix.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fix.java 30 Dec 2006 18:06:26 -0000 1.3 --- fix.java 7 Jan 2007 15:49:12 -0000 1.4 *************** *** 26,31 **** OperandToken temp = ((OperandToken)matrix.clone()); ! double[][] reValues = matrix.getReValues(); ! double[][] imValues = matrix.getImValues(); for(int y = 0; y < matrix.getSizeY(); y++) { --- 26,31 ---- OperandToken temp = ((OperandToken)matrix.clone()); ! double[][] reValues = matrix.getValuesRe(); ! double[][] imValues = matrix.getValuesIm(); for(int y = 0; y < matrix.getSizeY(); y++) { |
|
From: Stefan M. <st_...@us...> - 2007-01-07 15:43:59
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3349/Source/MathLib/Functions/Matrix Modified Files: isnan.java fliplr.java cumprod.java max.java isfinite.java flipud.java all.java min.java isinf.java Sum.java isreal.java cumsum.java Log Message: Index: min.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/min.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** min.java 15 Jul 2006 15:07:02 -0000 1.2 --- min.java 7 Jan 2007 15:43:55 -0000 1.3 *************** *** 22,27 **** // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getReValues(); ! double[][] a_i = ((NumberToken)operands[0]).getImValues(); int a_dy = a_r.length; int a_dx = a_r[0].length; --- 22,27 ---- // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getValuesRe(); ! double[][] a_i = ((NumberToken)operands[0]).getValuesIm(); int a_dy = a_r.length; int a_dx = a_r[0].length; *************** *** 73,78 **** throwMathLibException("min: only works on numbers"); ! double[][] b_r = ((NumberToken)operands[1]).getReValues(); ! double[][] b_i = ((NumberToken)operands[1]).getImValues(); int b_dy = b_r.length; int b_dx = b_r[0].length; --- 73,78 ---- throwMathLibException("min: only works on numbers"); ! double[][] b_r = ((NumberToken)operands[1]).getValuesRe(); ! double[][] b_i = ((NumberToken)operands[1]).getValuesIm(); int b_dy = b_r.length; int b_dx = b_r[0].length; Index: isnan.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/isnan.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** isnan.java 17 Dec 2006 14:37:22 -0000 1.1 --- isnan.java 7 Jan 2007 15:43:55 -0000 1.2 *************** *** 22,31 **** // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getReValues(); ! double[][] a_i = ((NumberToken)operands[0]).getImValues(); int a_dy = a_i.length; int a_dx = a_i[0].length; ! double[][] ret = ((NumberToken)operands[0]).getImValues(); for (int xi=0; xi<a_dx ; xi++) --- 22,31 ---- // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getValuesRe(); ! double[][] a_i = ((NumberToken)operands[0]).getValuesIm(); int a_dy = a_i.length; int a_dx = a_i[0].length; ! double[][] ret = ((NumberToken)operands[0]).getValuesIm(); for (int xi=0; xi<a_dx ; xi++) Index: all.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/all.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** all.java 9 Jul 2006 17:56:13 -0000 1.1 --- all.java 7 Jan 2007 15:43:55 -0000 1.2 *************** *** 21,26 **** // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getReValues(); ! double[][] a_i = ((NumberToken)operands[0]).getImValues(); int a_dy = a_r.length; int a_dx = a_r[0].length; --- 21,26 ---- // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getValuesRe(); ! double[][] a_i = ((NumberToken)operands[0]).getValuesIm(); int a_dy = a_r.length; int a_dx = a_r[0].length; Index: flipud.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/flipud.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** flipud.java 9 May 2004 10:08:52 -0000 1.2 --- flipud.java 7 Jan 2007 15:43:55 -0000 1.3 *************** *** 27,32 **** // get data from array ! double[][] real = ((NumberToken)operands[0]).getReValues(); ! double[][] imag = ((NumberToken)operands[0]).getImValues(); int dy = real.length; --- 27,32 ---- // get data from array ! double[][] real = ((NumberToken)operands[0]).getValuesRe(); ! double[][] imag = ((NumberToken)operands[0]).getValuesIm(); int dy = real.length; Index: fliplr.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/fliplr.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** fliplr.java 9 May 2004 10:08:51 -0000 1.2 --- fliplr.java 7 Jan 2007 15:43:55 -0000 1.3 *************** *** 27,32 **** // get data from array ! double[][] real = ((NumberToken)operands[0]).getReValues(); ! double[][] imag = ((NumberToken)operands[0]).getImValues(); int dy = real.length; --- 27,32 ---- // get data from array ! double[][] real = ((NumberToken)operands[0]).getValuesRe(); ! double[][] imag = ((NumberToken)operands[0]).getValuesIm(); int dy = real.length; Index: cumsum.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/cumsum.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cumsum.java 16 Dec 2006 13:40:06 -0000 1.3 --- cumsum.java 7 Jan 2007 15:43:55 -0000 1.4 *************** *** 24,29 **** // get data from arguments ! double[][] re = ((NumberToken)operands[0]).getReValues(); ! double[][] im = ((NumberToken)operands[0]).getImValues(); --- 24,29 ---- // get data from arguments ! double[][] re = ((NumberToken)operands[0]).getValuesRe(); ! double[][] im = ((NumberToken)operands[0]).getValuesIm(); Index: Sum.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/Sum.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Sum.java 6 Jan 2007 09:32:14 -0000 1.12 --- Sum.java 7 Jan 2007 15:43:55 -0000 1.13 *************** *** 45,50 **** if(operands[0] instanceof NumberToken) { ! double[][] xRe = ((NumberToken)operands[0]).getReValues(); ! double[][] xIm = ((NumberToken)operands[0]).getImValues(); int xSizeX = ((NumberToken)operands[0]).getSizeX(); int xSizeY = ((NumberToken)operands[0]).getSizeY(); --- 45,50 ---- if(operands[0] instanceof NumberToken) { ! double[][] xRe = ((NumberToken)operands[0]).getValuesRe(); ! double[][] xIm = ((NumberToken)operands[0]).getValuesIm(); int xSizeX = ((NumberToken)operands[0]).getSizeX(); int xSizeY = ((NumberToken)operands[0]).getSizeY(); Index: cumprod.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/cumprod.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cumprod.java 16 Dec 2006 13:44:58 -0000 1.1 --- cumprod.java 7 Jan 2007 15:43:55 -0000 1.2 *************** *** 23,28 **** // get data from arguments ! double[][] re = ((NumberToken)operands[0]).getReValues(); ! double[][] im = ((NumberToken)operands[0]).getImValues(); --- 23,28 ---- // get data from arguments ! double[][] re = ((NumberToken)operands[0]).getValuesRe(); ! double[][] im = ((NumberToken)operands[0]).getValuesIm(); Index: isfinite.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/isfinite.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** isfinite.java 17 Dec 2006 14:37:23 -0000 1.1 --- isfinite.java 7 Jan 2007 15:43:55 -0000 1.2 *************** *** 22,31 **** // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getReValues(); ! double[][] a_i = ((NumberToken)operands[0]).getImValues(); int a_dy = a_i.length; int a_dx = a_i[0].length; ! double[][] ret = ((NumberToken)operands[0]).getImValues(); for (int xi=0; xi<a_dx ; xi++) --- 22,31 ---- // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getValuesRe(); ! double[][] a_i = ((NumberToken)operands[0]).getValuesIm(); int a_dy = a_i.length; int a_dx = a_i[0].length; ! double[][] ret = ((NumberToken)operands[0]).getValuesIm(); for (int xi=0; xi<a_dx ; xi++) Index: isinf.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/isinf.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** isinf.java 17 Dec 2006 14:37:24 -0000 1.1 --- isinf.java 7 Jan 2007 15:43:55 -0000 1.2 *************** *** 22,31 **** // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getReValues(); ! double[][] a_i = ((NumberToken)operands[0]).getImValues(); int a_dy = a_i.length; int a_dx = a_i[0].length; ! double[][] ret = ((NumberToken)operands[0]).getImValues(); for (int xi=0; xi<a_dx ; xi++) --- 22,31 ---- // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getValuesRe(); ! double[][] a_i = ((NumberToken)operands[0]).getValuesIm(); int a_dy = a_i.length; int a_dx = a_i[0].length; ! double[][] ret = ((NumberToken)operands[0]).getValuesIm(); for (int xi=0; xi<a_dx ; xi++) Index: max.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/max.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** max.java 15 Jul 2006 15:06:48 -0000 1.1 --- max.java 7 Jan 2007 15:43:55 -0000 1.2 *************** *** 21,26 **** // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getReValues(); ! double[][] a_i = ((NumberToken)operands[0]).getImValues(); int a_dy = a_r.length; int a_dx = a_r[0].length; --- 21,26 ---- // get data from arguments ! double[][] a_r = ((NumberToken)operands[0]).getValuesRe(); ! double[][] a_i = ((NumberToken)operands[0]).getValuesIm(); int a_dy = a_r.length; int a_dx = a_r[0].length; *************** *** 72,77 **** throwMathLibException("max: only works on numbers"); ! double[][] b_r = ((NumberToken)operands[1]).getReValues(); ! double[][] b_i = ((NumberToken)operands[1]).getImValues(); int b_dy = b_r.length; int b_dx = b_r[0].length; --- 72,77 ---- throwMathLibException("max: only works on numbers"); ! double[][] b_r = ((NumberToken)operands[1]).getValuesRe(); ! double[][] b_i = ((NumberToken)operands[1]).getValuesIm(); int b_dy = b_r.length; int b_dx = b_r[0].length; Index: isreal.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/isreal.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** isreal.java 26 Dec 2006 18:26:54 -0000 1.2 --- isreal.java 7 Jan 2007 15:43:55 -0000 1.3 *************** *** 22,26 **** // get data from arguments ! double[][] a_i = ((NumberToken)operands[0]).getImValues(); int a_dy = a_i.length; int a_dx = a_i[0].length; --- 22,26 ---- // get data from arguments ! double[][] a_i = ((NumberToken)operands[0]).getValuesRe(); int a_dy = a_i.length; int a_dx = a_i[0].length; |
|
From: Stefan M. <st_...@us...> - 2007-01-07 15:43:08
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Interpreter In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2956/Source/MathLib/Interpreter Modified Files: LexicalAnalyser.java Log Message: support for multidimensional arrays Index: LexicalAnalyser.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Interpreter/LexicalAnalyser.java,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** LexicalAnalyser.java 26 Dec 2006 12:27:34 -0000 1.72 --- LexicalAnalyser.java 7 Jan 2007 15:43:04 -0000 1.73 *************** *** 541,545 **** { // real number ! nextToken = new NumberToken(number); } --- 541,545 ---- { // real number ! nextToken = new NumberToken(number, null); } |
|
From: Stefan M. <st_...@us...> - 2007-01-07 15:42:49
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2916/Source/MathLib/Tokens Modified Files: DataToken.java NumberToken.java SparseNumberToken.java MatrixToken.java Log Message: support for multidimensional arrays Index: NumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/NumberToken.java,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** NumberToken.java 6 Jan 2007 15:01:35 -0000 1.94 --- NumberToken.java 7 Jan 2007 15:42:46 -0000 1.95 *************** *** 2,22 **** import MathLib.Interpreter.*; import java.text.NumberFormat; /**Class representing numbers used in expression holds a 2D array of complex numers in a 3d array ! values[y][x][REAL/IMAG] All operations on a NumberToken create a new NumberToken*/ public class NumberToken extends DataToken { [...1088 lines suppressed...] if (getValueIm(n) != 0) --- 2326,2330 ---- { // if at least one element has a real part the matrix is not imaginary ! for (int n=0; n<noElem; n++) { if (getValueIm(n) != 0) *************** *** 2214,2218 **** boolean isIm = false; ! for (int n=0; n<no; n++) { if (getValueRe(n) != 0) --- 2342,2346 ---- boolean isIm = false; ! for (int n=0; n<noElem; n++) { if (getValueRe(n) != 0) Index: MatrixToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/MatrixToken.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** MatrixToken.java 6 Jan 2007 09:36:19 -0000 1.26 --- MatrixToken.java 7 Jan 2007 15:42:46 -0000 1.27 *************** *** 202,207 **** valSizeY = ((NumberToken)value[yy][xx]).getSizeY(); valSizeX = ((NumberToken)value[yy][xx]).getSizeX(); ! double[][] valRe = ((NumberToken)value[yy][xx]).getReValues(); ! double[][] valIm = ((NumberToken)value[yy][xx]).getImValues(); // copy small matrix of each element into global matrix --- 202,207 ---- valSizeY = ((NumberToken)value[yy][xx]).getSizeY(); valSizeX = ((NumberToken)value[yy][xx]).getSizeX(); ! double[][] valRe = ((NumberToken)value[yy][xx]).getValuesRe(); ! double[][] valIm = ((NumberToken)value[yy][xx]).getValuesIm(); // copy small matrix of each element into global matrix Index: DataToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/DataToken.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** DataToken.java 17 Oct 2006 18:10:18 -0000 1.14 --- DataToken.java 7 Jan 2007 15:42:46 -0000 1.15 *************** *** 7,14 **** { /** The horizontal size of the number matrix */ ! int sizeX; /** The vertical size of the number matrix */ ! int sizeY; /**Default Constructor*/ --- 7,22 ---- { /** The horizontal size of the number matrix */ ! protected int sizeX; /** The vertical size of the number matrix */ ! protected int sizeY; ! ! // dimension of N-D-Array (e.g. a(2,3,4)) ! // e.g. size={2,3} is a 2x3 array ! // e.g. size={2,3,4} is a 2x3x4 array ! protected int[] sizeA; ! ! // number of elements ! protected int noElem; /**Default Constructor*/ *************** *** 37,40 **** --- 45,58 ---- return sizeY; } + + /** + * + * @return + */ + public int getNumberOfElements() + { + return noElem; + } + //abstract Index: SparseNumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/SparseNumberToken.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SparseNumberToken.java 6 Jan 2007 15:01:35 -0000 1.3 --- SparseNumberToken.java 7 Jan 2007 15:42:46 -0000 1.4 *************** *** 306,315 **** } ! public OperandToken getElement(int y, int x) { return new NumberToken(values[y][x]); ! } ! public OperandToken getElement(int n) { int x = (int) (n/sizeY); // column to start --- 306,315 ---- } ! /*public OperandToken getElement(int y, int x) { return new NumberToken(values[y][x]); ! }*/ ! /*public OperandToken getElement(int n) { int x = (int) (n/sizeY); // column to start *************** *** 317,321 **** return new NumberToken(values[y][x]); ! } public void setElement(int y, int x, OperandToken num) --- 317,321 ---- return new NumberToken(values[y][x]); ! }*/ public void setElement(int y, int x, OperandToken num) *************** *** 715,720 **** double [][][]results = new double[sizeY][sizeX][2]; ! double argRe = argValues.getReValues()[0][0]; ! double argIm = argValues.getImValues()[0][0]; for (int yy=0; yy<sizeY; yy++) { --- 715,720 ---- double [][][]results = new double[sizeY][sizeX][2]; ! double argRe = argValues.getValueRe(); ! double argIm = argValues.getValueIm(); for (int yy=0; yy<sizeY; yy++) { |
|
From: Stefan M. <st_...@us...> - 2007-01-07 15:42:02
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2519/Source/MathLib/Tools/TestSuite/Tokens Modified Files: TestVariableToken.java Log Message: Index: TestVariableToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Tokens/TestVariableToken.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestVariableToken.java 3 Aug 2006 20:23:48 -0000 1.4 --- TestVariableToken.java 7 Jan 2007 15:41:58 -0000 1.5 *************** *** 31,35 **** variable1 = new VariableToken("x"); variable2 = new VariableToken("x"); ! number = new NumberToken("2"); ml = new Interpreter(true); } --- 31,35 ---- variable1 = new VariableToken("x"); variable2 = new VariableToken("x"); ! number = new NumberToken("2", null); ml = new Interpreter(true); } |
|
From: Stefan M. <st_...@us...> - 2007-01-06 15:03:36
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv8782 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** ChangeLog.txt 5 Jan 2007 17:22:15 -0000 1.140 --- ChangeLog.txt 6 Jan 2007 15:03:33 -0000 1.141 *************** *** 32,35 **** --- 32,40 ---- stefan * + 2007/01/06 + stefan * NumberToken.java ... Reorganized NumberToken. Elements are now stored + as a single vector instead of an array. This is a preparation for + future usage of NDArrays. + 2007/01/05 stefan + MathLib/Functions/IO/loadvariables.java |
|
From: Stefan M. <st_...@us...> - 2007-01-06 15:02:05
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/System In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7992/Source/MathLib/Functions/System Modified Files: NargOutChk.java NargChk.java NewLine.java Log Message: reorganized NumberToken. elements are now a single vector instead of an array. This is a preparation for future usage of NDArrays. Index: NargOutChk.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/System/NargOutChk.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NargOutChk.java 30 Dec 2006 17:54:08 -0000 1.8 --- NargOutChk.java 6 Jan 2007 15:02:00 -0000 1.9 *************** *** 30,36 **** { String message = ""; ! double min = ((NumberToken)operands[0]).getValue(); ! double max = ((NumberToken)operands[1]).getValue(); ! double val = ((NumberToken)operands[2]).getValue(); if(val < min) --- 30,36 ---- { String message = ""; ! double min = ((NumberToken)operands[0]).getValueRe(); ! double max = ((NumberToken)operands[1]).getValueRe(); ! double val = ((NumberToken)operands[2]).getValueRe(); if(val < min) Index: NargChk.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/System/NargChk.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NargChk.java 25 Nov 2006 13:29:13 -0000 1.7 --- NargChk.java 6 Jan 2007 15:02:00 -0000 1.8 *************** *** 30,36 **** { String message = ""; ! double min = ((NumberToken)operands[0]).getValue(); ! double max = ((NumberToken)operands[1]).getValue(); ! double val = ((NumberToken)operands[2]).getValue(); if(val < min) --- 30,36 ---- { String message = ""; ! double min = ((NumberToken)operands[0]).getValueRe(); ! double max = ((NumberToken)operands[1]).getValueRe(); ! double val = ((NumberToken)operands[2]).getValueRe(); if(val < min) Index: NewLine.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/System/NewLine.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NewLine.java 11 Jun 2002 07:50:24 -0000 1.3 --- NewLine.java 6 Jan 2007 15:02:00 -0000 1.4 *************** *** 17,21 **** if((operands.length > 0) && (operands[0] instanceof NumberToken)) { ! count = ((NumberToken)operands[0]).getValue(); } --- 17,21 ---- if((operands.length > 0) && (operands[0] instanceof NumberToken)) { ! count = ((NumberToken)operands[0]).getValueRe(); } |
|
From: Stefan M. <st_...@us...> - 2007-01-06 15:01:39
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7942/Source/MathLib/Tokens Modified Files: NumberToken.java SparseNumberToken.java Log Message: reorganized NumberToken. elements are now a single vector instead of an array. This is a preparation for future usage of NDArrays. Index: NumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/NumberToken.java,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** NumberToken.java 6 Jan 2007 09:36:19 -0000 1.93 --- NumberToken.java 6 Jan 2007 15:01:35 -0000 1.94 *************** *** 6,15 **** /**Class representing numbers used in expression holds a 2D array of complex numers in a 3d array ! values[y][x][REAL/IMAGINARY] All operations on a NumberToken create a new NumberToken*/ public class NumberToken extends DataToken { /**Complex values of the token*/ ! private double values[][][]; /**Constant value set to 1*/ [...2754 lines suppressed...] ! for (int x=0; x<sizeX; x++) ! { ! if (values[y][x][REAL] != 0) isRe = true; ! if (values[y][x][IMAGINARY] != 0) isIm = true; - } } --- 2214,2223 ---- boolean isIm = false; ! for (int n=0; n<no; n++) { ! if (getValueRe(n) != 0) isRe = true; ! if (getValueIm(n)!= 0) isIm = true; } Index: SparseNumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/SparseNumberToken.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SparseNumberToken.java 6 Jan 2007 09:36:19 -0000 1.2 --- SparseNumberToken.java 6 Jan 2007 15:01:35 -0000 1.3 *************** *** 234,238 **** /**@return the imaginary value of the first number*/ ! public double getValueImg() { return values[0][0][IMAGINARY]; --- 234,238 ---- /**@return the imaginary value of the first number*/ ! public double getValueIm() { return values[0][0][IMAGINARY]; *************** *** 240,244 **** /**@return the imaginary value of the number at position y, x*/ ! public double getValueImg(int y, int x) { return values[y][x][IMAGINARY]; --- 240,244 ---- /**@return the imaginary value of the number at position y, x*/ ! public double getValueIm(int y, int x) { return values[y][x][IMAGINARY]; *************** *** 322,326 **** { double real = ((NumberToken)num).getValueRe(); ! double imag = ((NumberToken)num).getValueImg(); ErrorLogger.debugLine("NumberToken("+y+","+x+")"+ real+" "+imag); --- 322,326 ---- { double real = ((NumberToken)num).getValueRe(); ! double imag = ((NumberToken)num).getValueIm(); ErrorLogger.debugLine("NumberToken("+y+","+x+")"+ real+" "+imag); *************** *** 334,338 **** int y = n - x*sizeY; // row to start double real = ((NumberToken)num).getValueRe(); ! double imag = ((NumberToken)num).getValueImg(); ErrorLogger.debugLine("NumberToken("+y+","+x+")"+ real+" "+imag); --- 334,338 ---- int y = n - x*sizeY; // row to start double real = ((NumberToken)num).getValueRe(); ! double imag = ((NumberToken)num).getValueIm(); ErrorLogger.debugLine("NumberToken("+y+","+x+")"+ real+" "+imag); *************** *** 471,475 **** { if((values[yy][xx][REAL] - nArg.getValueRe(yy, xx) != 0) || ! (values[yy][xx][IMAGINARY] - nArg.getValueImg(yy, xx) != 0)) equal = false; } --- 471,475 ---- { if((values[yy][xx][REAL] - nArg.getValueRe(yy, xx) != 0) || ! (values[yy][xx][IMAGINARY] - nArg.getValueIm(yy, xx) != 0)) equal = false; } *************** *** 515,519 **** { double realval = values[yy][xx][REAL] + nArg.getValueRe(yy, xx); ! double imaginaryval = values[yy][xx][IMAGINARY] + nArg.getValueImg(yy, xx); result.setValue(yy, xx, realval, imaginaryval); } --- 515,519 ---- { double realval = values[yy][xx][REAL] + nArg.getValueRe(yy, xx); ! double imaginaryval = values[yy][xx][IMAGINARY] + nArg.getValueIm(yy, xx); result.setValue(yy, xx, realval, imaginaryval); } *************** *** 528,532 **** NumberToken result = nArg; double re = getValueRe(0, 0); ! double im = getValueImg(0, 0); for(int yy = 0; yy < argSizeY; yy++) --- 528,532 ---- NumberToken result = nArg; double re = getValueRe(0, 0); ! double im = getValueIm(0, 0); for(int yy = 0; yy < argSizeY; yy++) *************** *** 535,539 **** { double realval = nArg.getValueRe(yy,xx) + re; ! double imaginaryval = nArg.getValueImg(yy,xx) + im; result.setValue(yy, xx, realval, imaginaryval); } --- 535,539 ---- { double realval = nArg.getValueRe(yy,xx) + re; ! double imaginaryval = nArg.getValueIm(yy,xx) + im; result.setValue(yy, xx, realval, imaginaryval); } *************** *** 548,552 **** NumberToken result = new NumberToken(values); double re = nArg.getValueRe(0, 0); ! double im = nArg.getValueImg(0, 0); for(int yy = 0; yy < sizeY; yy++) --- 548,552 ---- NumberToken result = new NumberToken(values); double re = nArg.getValueRe(0, 0); ! double im = nArg.getValueIm(0, 0); for(int yy = 0; yy < sizeY; yy++) *************** *** 594,598 **** { double realval = values[yy][xx][REAL] - nArg.getValueRe(yy, xx); ! double imaginaryval = values[yy][xx][IMAGINARY] - nArg.getValueImg(yy, xx); result.setValue(yy, xx, realval, imaginaryval); } --- 594,598 ---- { double realval = values[yy][xx][REAL] - nArg.getValueRe(yy, xx); ! double imaginaryval = values[yy][xx][IMAGINARY] - nArg.getValueIm(yy, xx); result.setValue(yy, xx, realval, imaginaryval); } *************** *** 606,610 **** NumberToken result = nArg; double re = getValueRe(0, 0); ! double im = getValueImg(0, 0); for(int yy = 0; yy < argSizeY; yy++) --- 606,610 ---- NumberToken result = nArg; double re = getValueRe(0, 0); ! double im = getValueIm(0, 0); for(int yy = 0; yy < argSizeY; yy++) *************** *** 613,617 **** { double realval = re - nArg.getValueRe(yy,xx); ! double imaginaryval = im - nArg.getValueImg(yy,xx); result.setValue(yy, xx, realval, imaginaryval); } --- 613,617 ---- { double realval = re - nArg.getValueRe(yy,xx); ! double imaginaryval = im - nArg.getValueIm(yy,xx); result.setValue(yy, xx, realval, imaginaryval); } *************** *** 625,629 **** NumberToken result = new NumberToken(values); double re = nArg.getValueRe(0, 0); ! double im = nArg.getValueImg(0, 0); for(int yy = 0; yy < sizeY; yy++) --- 625,629 ---- NumberToken result = new NumberToken(values); double re = nArg.getValueRe(0, 0); ! double im = nArg.getValueIm(0, 0); for(int yy = 0; yy < sizeY; yy++) *************** *** 909,914 **** NumberToken nArg = ((NumberToken)arg); ! double[][] argValues = nArg.getReValues(); ! double[][] argValuesImg = nArg.getValuesImg(); int argSizeX = nArg.getSizeX(); int argSizeY = nArg.getSizeY(); --- 909,914 ---- NumberToken nArg = ((NumberToken)arg); ! double[][] argValues = nArg.getValuesIm(); ! double[][] argValuesImg = nArg.getValuesIm(); int argSizeX = nArg.getSizeX(); int argSizeY = nArg.getSizeY(); *************** *** 981,986 **** NumberToken nArg = ((NumberToken)arg); ! double[][] argValues = nArg.getReValues(); ! double[][] argValuesImg = nArg.getValuesImg(); int argSizeX = nArg.getSizeX(); int argSizeY = nArg.getSizeY(); --- 981,986 ---- NumberToken nArg = ((NumberToken)arg); ! double[][] argValues = nArg.getValuesRe(); ! double[][] argValuesImg = nArg.getValuesIm(); int argSizeX = nArg.getSizeX(); int argSizeY = nArg.getSizeY(); |
|
From: Stefan M. <st_...@us...> - 2007-01-06 15:01:38
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Interpreter In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7942/Source/MathLib/Interpreter Modified Files: Parser.java Interpreter.java Log Message: reorganized NumberToken. elements are now a single vector instead of an array. This is a preparation for future usage of NDArrays. Index: Interpreter.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Interpreter/Interpreter.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Interpreter.java 6 Jan 2007 09:35:12 -0000 1.66 --- Interpreter.java 6 Jan 2007 15:01:35 -0000 1.67 *************** *** 261,265 **** if (number.isScalar()) ! return number.getValueImg(); else return 0.0; --- 261,265 ---- if (number.isScalar()) ! return number.getValueIm(); else return 0.0; *************** *** 307,311 **** NumberToken number = (NumberToken)(variableData.clone()); ! return number.getValuesImg(); } --- 307,311 ---- NumberToken number = (NumberToken)(variableData.clone()); ! return number.getValuesIm(); } Index: Parser.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Interpreter/Parser.java,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** Parser.java 6 Jan 2007 09:35:12 -0000 1.123 --- Parser.java 6 Jan 2007 15:01:35 -0000 1.124 *************** *** 1441,1445 **** // check if matrix has imaginary values ! if (numberT.getValuesImg() != null) imagIndicatorB = true; --- 1441,1445 ---- // check if matrix has imaginary values ! if (numberT.getValuesIm() != null) imagIndicatorB = true; *************** *** 1532,1536 **** if (imagIndicatorB) { ! valuesImag[yy][xx] = n.getValueImg(); } } --- 1532,1536 ---- if (imagIndicatorB) { ! valuesImag[yy][xx] = n.getValueIm(); } } |
|
From: Stefan M. <st_...@us...> - 2007-01-06 15:00:21
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tools/junit/swingui In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7261/Source/MathLib/Tools/junit/swingui Modified Files: CounterPanel.java Log Message: made counter field much larger Index: CounterPanel.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tools/junit/swingui/CounterPanel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CounterPanel.java 16 May 2004 08:12:54 -0000 1.2 --- CounterPanel.java 6 Jan 2007 15:00:16 -0000 1.3 *************** *** 15,21 **** public CounterPanel() { super(new GridLayout(2, 3)); ! add(new JLabel("Runs:")); ! add(new JLabel("Errors:")); ! add(new JLabel("Failures: ")); fNumberOfErrors= createOutputField(); fNumberOfFailures= createOutputField(); --- 15,21 ---- public CounterPanel() { super(new GridLayout(2, 3)); ! add(new JLabel(" Runs: ")); ! add(new JLabel(" Errors: ")); ! add(new JLabel(" Failures: ")); fNumberOfErrors= createOutputField(); fNumberOfFailures= createOutputField(); |
|
From: Stefan M. <st_...@us...> - 2007-01-06 14:26:07
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25124/Source/MathLib/Tools/TestSuite/Tokens Modified Files: TestNumberToken.java Log Message: added tests for NumberToken.setSize() Index: TestNumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Tokens/TestNumberToken.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TestNumberToken.java 26 Dec 2006 15:12:49 -0000 1.14 --- TestNumberToken.java 6 Jan 2007 14:25:59 -0000 1.15 *************** *** 537,540 **** --- 537,560 ---- assertTrue(Compare.ArrayEquals(dr, ml.getArrayValueRe("d"), 0.001)); } + + public void testSetSize01() { + ml.executeExpression("a=[1,2;3,4]"); + ml.executeExpression("a(3:4,3:4)=[5.0, 6.0; 7.0, 8.0]"); + double[][] bRe = {{1.0, 2.0, 0.0, 0.0}, + {3.0, 4.0, 0.0, 0.0}, + {0.0, 0.0, 5.0, 6.0}, + {0.0, 0.0, 7.0, 8.0} }; + assertTrue(Compare.ArrayEquals(bRe, ml.getArrayValueRe("a"))); + } + + public void testSetSize02() { + double[][] n1 = {{1,2},{4,5}}; + NumberToken n=new NumberToken(n1); + n.setSize(3,2); + + double[][] r1= {{1.0, 2.0},{4.0, 5.0}, {0.0, 0.0}}; + assertTrue(Compare.ArrayEquals( r1 , n.getValuesRe() )); + + } |
|
From: Stefan M. <st_...@us...> - 2007-01-06 09:36:25
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv13901/Source/MathLib/Tokens Modified Files: CaseToken.java NumberToken.java ConditionToken.java SparseNumberToken.java MatrixToken.java Log Message: getValue() replaced by getValueRe() Index: NumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/NumberToken.java,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** NumberToken.java 26 Dec 2006 15:13:16 -0000 1.92 --- NumberToken.java 6 Jan 2007 09:36:19 -0000 1.93 *************** *** 202,216 **** /**@return the real value of the first number*/ ! public double getValue() ! { ! return values[0][0][REAL]; ! } ! ! /**@return the real value of the first number*/ ! //public double getValueRe() //{ // return values[0][0][REAL]; //} /**@return the real value of the number at position y, x*/ public double getValueRe(int y, int x) --- 202,216 ---- /**@return the real value of the first number*/ ! //public double getValue() //{ // return values[0][0][REAL]; //} + /**@return the real value of the first number*/ + public double getValueRe() + { + return getValueRe(0, 0); + } + /**@return the real value of the number at position y, x*/ public double getValueRe(int y, int x) *************** *** 219,222 **** --- 219,230 ---- } + public double getValueRe(int n) + { + int x = (int) (n/sizeY); // column to start + int y = n - x*sizeY; // row to start + return values[y][x][REAL]; + } + + /**@return the real value of the first number as an integer*/ //public int getIntValue() *************** *** 236,240 **** public double getValueImg() { ! return values[0][0][IMAGINARY]; } --- 244,248 ---- public double getValueImg() { ! return getValueImg(0, 0); } *************** *** 244,247 **** --- 252,263 ---- return values[y][x][IMAGINARY]; } + + public double getValueImg(int n) + { + int x = (int) (n/sizeY); // column to start + int y = n - x*sizeY; // row to start + return values[y][x][IMAGINARY]; + } + /**@return the absolute value of the number at position y, x*/ *************** *** 309,312 **** --- 325,333 ---- } + public int getNumberOfElements() + { + return sizeY*sizeX; + } + public OperandToken getElement(int y, int x) { *************** *** 324,328 **** public void setElement(int y, int x, OperandToken num) { ! double real = ((NumberToken)num).getValue(); double imag = ((NumberToken)num).getValueImg(); --- 345,349 ---- public void setElement(int y, int x, OperandToken num) { ! double real = ((NumberToken)num).getValueRe(); double imag = ((NumberToken)num).getValueImg(); *************** *** 336,340 **** int x = (int)(n/sizeY); // column to start int y = n - x*sizeY; // row to start ! double real = ((NumberToken)num).getValue(); double imag = ((NumberToken)num).getValueImg(); --- 357,361 ---- int x = (int)(n/sizeY); // column to start int y = n - x*sizeY; // row to start ! double real = ((NumberToken)num).getValueRe(); double imag = ((NumberToken)num).getValueImg(); Index: MatrixToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/MatrixToken.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** MatrixToken.java 26 Dec 2006 12:28:13 -0000 1.25 --- MatrixToken.java 6 Jan 2007 09:36:19 -0000 1.26 *************** *** 158,162 **** { // e.g. ['asdf' 65] -> 'asdfA' ! byte[] b = { new Double( ((NumberToken)value[0][x]).getValue() ).byteValue() }; try{ retString += new String(b, "UTF8"); --- 158,162 ---- { // e.g. ['asdf' 65] -> 'asdfA' ! byte[] b = { new Double( ((NumberToken)value[0][x]).getValueRe() ).byteValue() }; try{ retString += new String(b, "UTF8"); Index: CaseToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/CaseToken.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CaseToken.java 14 Jul 2006 19:41:08 -0000 1.9 --- CaseToken.java 6 Jan 2007 09:36:19 -0000 1.10 *************** *** 44,48 **** if(result instanceof NumberToken) { ! if(((NumberToken)result).getValue() != 0) { ErrorLogger.debugLine("case is TRUE "); --- 44,48 ---- if(result instanceof NumberToken) { ! if(((NumberToken)result).getValueRe() != 0) { ErrorLogger.debugLine("case is TRUE "); Index: SparseNumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/SparseNumberToken.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SparseNumberToken.java 26 Dec 2006 12:28:52 -0000 1.1 --- SparseNumberToken.java 6 Jan 2007 09:36:19 -0000 1.2 *************** *** 321,325 **** public void setElement(int y, int x, OperandToken num) { ! double real = ((NumberToken)num).getValue(); double imag = ((NumberToken)num).getValueImg(); --- 321,325 ---- public void setElement(int y, int x, OperandToken num) { ! double real = ((NumberToken)num).getValueRe(); double imag = ((NumberToken)num).getValueImg(); *************** *** 333,337 **** int x = (int)(n/sizeY); // column to start int y = n - x*sizeY; // row to start ! double real = ((NumberToken)num).getValue(); double imag = ((NumberToken)num).getValueImg(); --- 333,337 ---- int x = (int)(n/sizeY); // column to start int y = n - x*sizeY; // row to start ! double real = ((NumberToken)num).getValueRe(); double imag = ((NumberToken)num).getValueImg(); Index: ConditionToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/ConditionToken.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ConditionToken.java 14 Jul 2006 19:41:07 -0000 1.8 --- ConditionToken.java 6 Jan 2007 09:36:19 -0000 1.9 *************** *** 44,48 **** if(result instanceof NumberToken) { ! if(((NumberToken)result).getValue() != 0) { code.evaluate(null); --- 44,48 ---- if(result instanceof NumberToken) { ! if(((NumberToken)result).getValueRe() != 0) { code.evaluate(null); |
|
From: Stefan M. <st_...@us...> - 2007-01-06 09:35:32
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Functions/Matrix In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv13555/Source/MathLib/Tools/TestSuite/Functions/Matrix Modified Files: testDet.java Log Message: getValue() replaced by getValueRe() Index: testDet.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tools/TestSuite/Functions/Matrix/testDet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testDet.java 5 Jan 2007 13:31:43 -0000 1.1 --- testDet.java 6 Jan 2007 09:35:29 -0000 1.2 *************** *** 2,6 **** import MathLib.Tools.junit.framework.*; ! import MathLib.Tools.TestSuite.*; import MathLib.Interpreter.*; --- 2,6 ---- import MathLib.Tools.junit.framework.*; ! //import MathLib.Tools.TestSuite.*; import MathLib.Interpreter.*; |
|
From: Stefan M. <st_...@us...> - 2007-01-06 09:35:18
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Interpreter In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv13311/Source/MathLib/Interpreter Modified Files: Parser.java Interpreter.java Log Message: getValue() replaced by getValueRe() Index: Interpreter.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Interpreter/Interpreter.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** Interpreter.java 5 Jan 2007 17:18:19 -0000 1.65 --- Interpreter.java 6 Jan 2007 09:35:12 -0000 1.66 *************** *** 238,242 **** if (number.isScalar()) ! return number.getValue(); else return 0.0; --- 238,242 ---- if (number.isScalar()) ! return number.getValueRe(); else return 0.0; Index: Parser.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Interpreter/Parser.java,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** Parser.java 30 Nov 2006 19:05:26 -0000 1.122 --- Parser.java 6 Jan 2007 09:35:12 -0000 1.123 *************** *** 1529,1533 **** { NumberToken n = (NumberToken)elements.pop(); ! values[yy][xx] = n.getValue(); if (imagIndicatorB) { --- 1529,1533 ---- { NumberToken n = (NumberToken)elements.pop(); ! values[yy][xx] = n.getValueRe(); if (imagIndicatorB) { |