mathlib-commitlog Mailing List for JMathLib - Octave, Matlab clone in java (Page 40)
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-21 16:22:45
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3259/Source/MathLib/Functions/General Added Files: bench.m Log Message: --- NEW FILE: bench.m --- tic; a=linspace(0,100,100); toc |
|
From: Stefan M. <st_...@us...> - 2007-01-21 16:22:14
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2914/Source/MathLib/Tokens Modified Files: RelationOperatorToken.java LogicalToken.java Log Message: added support for LogicalToken Index: RelationOperatorToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/RelationOperatorToken.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** RelationOperatorToken.java 21 Jan 2007 13:30:23 -0000 1.18 --- RelationOperatorToken.java 21 Jan 2007 16:22:09 -0000 1.19 *************** *** 55,58 **** --- 55,67 ---- ErrorLogger.debugLine("RelationToken: evaluate"); + // it is much easier to compare number, so convert to number + if (operands[0] instanceof LogicalToken) + operands[0]=((LogicalToken)operands[0]).getNumberToken(); + + // it is much easier to compare number, so convert to number + if (operands[1] instanceof LogicalToken) + operands[1]=((LogicalToken)operands[1]).getNumberToken(); + + if ( (operands[0] instanceof NumberToken) && (operands[1] instanceof NumberToken) ) Index: LogicalToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/LogicalToken.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LogicalToken.java 20 Jan 2007 15:26:33 -0000 1.1 --- LogicalToken.java 21 Jan 2007 16:22:09 -0000 1.2 *************** *** 347,350 **** --- 347,369 ---- } + + /** + * conversion into a number token + * @return + */ + public NumberToken getNumberToken() + { + double[] ret = new double[values.length]; + + for (int i=0; i<values.length; i++) + { + if (values[i]) + ret[i]=1.0; + else + ret[i]=0.0; + } + + return new NumberToken(sizeA, ret, null); + } |
|
From: Stefan M. <st_...@us...> - 2007-01-21 16:21:42
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2657/Source/MathLib/Functions/Matrix Modified Files: and.java max.java any.java all.java not.java or.java min.java Log Message: added support for LogicalToken Index: min.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/min.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** min.java 7 Jan 2007 15:43:55 -0000 1.3 --- min.java 21 Jan 2007 16:21:34 -0000 1.4 *************** *** 17,20 **** --- 17,24 ---- throwMathLibException("min: number of arguments 1 or 2"); + // if boolean: convert LogicalToken to NumberToken + if (operands[0] instanceof LogicalToken) + operands[0]=((LogicalToken)operands[0]).getNumberToken(); + if (!(operands[0] instanceof NumberToken)) throwMathLibException("min: only works on numbers"); *************** *** 70,73 **** --- 74,81 ---- // min(888, 999) or min(2, [4,5,6]) + // if boolean: convert LogicalToken to NumberToken + if (operands[1] instanceof LogicalToken) + operands[1]=((LogicalToken)operands[1]).getNumberToken(); + if (!(operands[1] instanceof NumberToken)) throwMathLibException("min: only works on numbers"); Index: all.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/all.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** all.java 7 Jan 2007 15:43:55 -0000 1.2 --- all.java 21 Jan 2007 16:21:34 -0000 1.3 *************** *** 17,21 **** throwMathLibException("all: number of arguments != 1"); ! if (!(operands[0] instanceof NumberToken)) return null; --- 17,26 ---- throwMathLibException("all: number of arguments != 1"); ! // if boolean: convert LogicalToken to NumberToken ! if (operands[0] instanceof LogicalToken) ! operands[0]=((LogicalToken)operands[0]).getNumberToken(); ! ! if (!(operands[0] instanceof NumberToken)) ! throwMathLibException("all: works on numbers and booleans"); Index: not.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/not.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** not.java 26 Dec 2006 12:25:08 -0000 1.6 --- not.java 21 Jan 2007 16:21:34 -0000 1.7 *************** *** 13,48 **** { ! // two operands (e.g. not(A) ) ! if (operands == null) return null; ! if (operands.length != 1) return null; ! if (operands[0] == null) return null; ! if (!(operands[0] instanceof NumberToken)) return null; ! ! ! // get data from arguments ! double[][] a = ((NumberToken)operands[0]).getReValues(); ! int a_dy = a.length; ! int a_dx = a[0].length; ! ! // create matrix ! double[][] values = new double[a_dy][a_dx]; ! for (int xi=0; xi<a_dx ; xi++) ! { ! for (int yi=0; yi<a_dy ; yi++) ! { ! if (a[yi][xi] == 0.0) { ! values[yi][xi] = 1.0; } else { ! values[yi][xi] = 0.0; } ! } ! ! } ! return new NumberToken(values); ! } // end eval } --- 13,60 ---- { ! // two operands (e.g. not(A) ) ! if (getNArgIn(operands) != 1) ! throwMathLibException("not: number of arguments != 1"); ! ! if (operands[0] instanceof NumberToken) ! { ! NumberToken num = (NumberToken)operands[0]; ! int n = num.getNumberOfElements(); ! ! double[] values = new double[n]; ! ! for (int i=0; i<n ; i++) ! { ! if (num.getValueRe(i) != 0.0) { ! values[i] = 1.0; } else { ! values[i] = 0.0; } ! } ! return new NumberToken(num.getSize(), values, null); ! } ! else if (operands[0] instanceof LogicalToken) ! { ! LogicalToken l = (LogicalToken)operands[0]; ! int n = l.getNumberOfElements(); ! boolean[] ret = new boolean[n]; ! ! for (int i=0; i<n; i++) ! { ! ret[i] = !l.getValue(i); ! } ! ! return new LogicalToken(l.getSize(), ret); ! } ! else ! { ! throwMathLibException("not: works on numbers and logical only"); ! return null; ! } ! } // end eval } Index: and.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/and.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** and.java 26 Dec 2006 12:24:16 -0000 1.8 --- and.java 21 Jan 2007 16:21:33 -0000 1.9 *************** *** 17,24 **** if (getNArgIn(operands) != 2) throwMathLibException("and: number of arguments != 2"); ! ! if (!(operands[0] instanceof NumberToken)) return null; ! if (!(operands[1] instanceof NumberToken)) return null; --- 17,33 ---- if (getNArgIn(operands) != 2) throwMathLibException("and: number of arguments != 2"); + + // if boolean: convert LogicalToken to NumberToken + if (operands[0] instanceof LogicalToken) + operands[0]=((LogicalToken)operands[0]).getNumberToken(); + + // if boolean: convert LogicalToken to NumberToken + if (operands[1] instanceof LogicalToken) + operands[1]=((LogicalToken)operands[1]).getNumberToken(); + ! if (!(operands[0] instanceof NumberToken) || ! !(operands[1] instanceof NumberToken) ) ! throwMathLibException("and: works on number and booleans only"); Index: any.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/any.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** any.java 26 Dec 2006 12:24:17 -0000 1.8 --- any.java 21 Jan 2007 16:21:34 -0000 1.9 *************** *** 16,39 **** if (getNArgIn(operands) != 1) throwMathLibException("any: number of arguments != 1"); - - if (!(operands[0] instanceof NumberToken)) return null; - - - // get data from arguments - double[][] a = ((NumberToken)operands[0]).getReValues(); - int a_dy = a.length; - int a_dx = a[0].length; ! ! for (int xi=0; xi<a_dx ; xi++) ! { ! for (int yi=0; yi<a_dy ; yi++) ! { ! if (a[yi][xi] != 0.0) return new NumberToken(1.0); ! } ! ! } ! return new NumberToken(0.0); } // end eval } --- 16,40 ---- if (getNArgIn(operands) != 1) throwMathLibException("any: number of arguments != 1"); ! // if boolean: convert LogicalToken to NumberToken ! if (operands[0] instanceof LogicalToken) ! operands[0]=((LogicalToken)operands[0]).getNumberToken(); ! ! ! if (operands[0] instanceof NumberToken) ! { ! NumberToken num = (NumberToken)operands[0]; ! ! for (int i=0; i<num.getNumberOfElements(); i++) ! { ! if (num.getValueRe(i) != 0.0) ! return new LogicalToken(true); ! } ! return new LogicalToken(false); ! } + throwMathLibException("any: works on numbers and booleans only"); + return null; + } // end eval } Index: max.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/max.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** max.java 7 Jan 2007 15:43:55 -0000 1.2 --- max.java 21 Jan 2007 16:21:34 -0000 1.3 *************** *** 16,19 **** --- 16,23 ---- throwMathLibException("max: number of arguments 1 or 2"); + // if boolean: convert LogicalToken to NumberToken + if (operands[0] instanceof LogicalToken) + operands[0]=((LogicalToken)operands[0]).getNumberToken(); + if (!(operands[0] instanceof NumberToken)) throwMathLibException("max: only works on numbers"); *************** *** 69,72 **** --- 73,80 ---- // max(888, 999) or max(2, [4,5,6]) + // if boolean: convert LogicalToken to NumberToken + if (operands[1] instanceof LogicalToken) + operands[1]=((LogicalToken)operands[1]).getNumberToken(); + if (!(operands[1] instanceof NumberToken)) throwMathLibException("max: only works on numbers"); Index: or.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/Matrix/or.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** or.java 26 Dec 2006 12:25:08 -0000 1.6 --- or.java 21 Jan 2007 16:21:34 -0000 1.7 *************** *** 15,24 **** // two operands (e.g. or(A,B) ) ! if (operands == null) return null; ! if (operands.length != 2) return null; ! if (operands[0] == null) return null; ! if (operands[1] == null) return null; ! if (!(operands[0] instanceof NumberToken)) return null; ! if (!(operands[1] instanceof NumberToken)) return null; --- 15,33 ---- // two operands (e.g. or(A,B) ) ! // two operands (e.g. and(A,B) ) ! if (getNArgIn(operands) != 2) ! throwMathLibException("or: number of arguments != 2"); ! ! // if boolean: convert LogicalToken to NumberToken ! if (operands[0] instanceof LogicalToken) ! operands[0]=((LogicalToken)operands[0]).getNumberToken(); ! ! // if boolean: convert LogicalToken to NumberToken ! if (operands[1] instanceof LogicalToken) ! operands[1]=((LogicalToken)operands[1]).getNumberToken(); ! ! if (!(operands[0] instanceof NumberToken) || ! !(operands[1] instanceof NumberToken) ) ! throwMathLibException("or: works on number and booleans only"); |
|
From: Stefan M. <st_...@us...> - 2007-01-21 13:54:30
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv11803 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** ChangeLog.txt 21 Jan 2007 13:34:37 -0000 1.157 --- ChangeLog.txt 21 Jan 2007 13:54:27 -0000 1.158 *************** *** 40,43 **** --- 40,44 ---- 2007/01/21 stefan * Tokens/RelationOperatorToken.java now returning LogicalTokens + stefan * Tokens/ConditionToken.java added support for LogicalTokens 2007/01/20 |
|
From: Stefan M. <st_...@us...> - 2007-01-21 13:53:59
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv11201/Source/MathLib/Tokens Modified Files: ConditionToken.java Log Message: added support for LogicalTokens Index: ConditionToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/ConditionToken.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ConditionToken.java 6 Jan 2007 09:36:19 -0000 1.9 --- ConditionToken.java 21 Jan 2007 13:53:52 -0000 1.10 *************** *** 21,25 **** } ! public OperandToken getCondition() { --- 21,28 ---- } ! /** ! * ! * @return ! */ public OperandToken getCondition() { *************** *** 27,30 **** --- 30,37 ---- } + /** + * + * @return + */ public OperandToken getExpression() { *************** *** 39,53 **** if(condition != null) { ! ErrorLogger.debugLine("testing " + condition.toString()); OperandToken result = condition.evaluate(null); if(result instanceof NumberToken) { ! if(((NumberToken)result).getValueRe() != 0) { ! code.evaluate(null); return NumberToken.one; } } } else --- 46,90 ---- if(condition != null) { ! ErrorLogger.debugLine("ConditionToken: testing " + condition.toString()); OperandToken result = condition.evaluate(null); if(result instanceof NumberToken) { ! NumberToken num = (NumberToken)result; ! boolean tag = true; ! ! // all elements must by unequal zero ! for (int i=0; i<num.getNumberOfElements(); i++) ! { ! if (num.getValueRe(i)==0.0) ! tag = false; ! } ! ! if(tag) { ! // evaluate Code ! code.evaluate(null); return NumberToken.one; } } + else if(result instanceof LogicalToken) + { + LogicalToken l = (LogicalToken)result; + boolean tag = true; + + // all elements must be unequal "false" + for (int i=0; i<l.getNumberOfElements(); i++) + { + if (l.getValue(i)==false) + tag = false; + } + + if (tag) + { + // evaluate Code + code.evaluate(null); + return NumberToken.one; + } + } } else *************** *** 62,66 **** /**Convert the operator to a string ! @return the operator as a string*/ public String toString() { --- 99,104 ---- /**Convert the operator to a string ! * @return the operator as a string ! */ public String toString() { *************** *** 80,83 **** } ! } --- 118,121 ---- } ! } // end ConditionToken |
|
From: Stefan M. <st_...@us...> - 2007-01-21 13:34:41
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv31408 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** ChangeLog.txt 20 Jan 2007 16:10:57 -0000 1.156 --- ChangeLog.txt 21 Jan 2007 13:34:37 -0000 1.157 *************** *** 38,41 **** --- 38,44 ---- stefan * + 2007/01/21 + stefan * Tokens/RelationOperatorToken.java now returning LogicalTokens + 2007/01/20 stefan + Tokens/NumberTokens/DoubleNumberToken.java |
|
From: Stefan M. <st_...@us...> - 2007-01-21 13:30:42
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv29111/Source/MathLib/Tokens Modified Files: RelationOperatorToken.java DataToken.java Log Message: introduced LogicalToken Index: RelationOperatorToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/RelationOperatorToken.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** RelationOperatorToken.java 26 Dec 2006 12:28:52 -0000 1.17 --- RelationOperatorToken.java 21 Jan 2007 13:30:23 -0000 1.18 *************** *** 8,18 **** /**Constructor taking the operator and priority ! @param _operator = the operator being created*/ public RelationOperatorToken (char _operator) { - //call the super constructor, type defaults to ttoperator and operands to 2 super(_operator, RELATION_PRIORITY); } public int getPriority() { --- 8,22 ---- /**Constructor taking the operator and priority ! * @param _operator = the operator being created ! */ public RelationOperatorToken (char _operator) { super(_operator, RELATION_PRIORITY); } + /** + * + * @return priority of current relation (e.g. < > | & && ...) + */ public int getPriority() { *************** *** 43,53 **** /**evaluates the operator ! @param operands = the operators operands ! @return the result as an OperandToken*/ public OperandToken evaluate(Token[] operands) { - OperandToken result = null; ! ErrorLogger.debugLine("Parser: Relation: evaluate"); if ( (operands[0] instanceof NumberToken) --- 47,57 ---- /**evaluates the operator ! * @param operands = the operators operands ! * @return the result as an OperandToken ! */ public OperandToken evaluate(Token[] operands) { ! ErrorLogger.debugLine("RelationToken: evaluate"); if ( (operands[0] instanceof NumberToken) *************** *** 55,127 **** { // two operands and both a numbers ! // e.g. 2>3, 3>=6, 4!=3 ! double[][] op0Values = ((NumberToken)operands[0]).getReValues(); ! int op0SizeX = ((NumberToken)operands[0]).getSizeX(); ! int op0SizeY = ((NumberToken)operands[0]).getSizeY(); ! double[][] op1Values = ((NumberToken)operands[1]).getReValues(); ! int op1SizeX = ((NumberToken)operands[1]).getSizeX(); ! int op1SizeY = ((NumberToken)operands[1]).getSizeY(); ! ! if ( (op0SizeX == 1) && (op0SizeY == 1) ! && (op1SizeX == 1) && (op1SizeY == 1) ) { ! // scalar operator scalar // e.g. 2!=3, 5>6 ! double returnValue = evalRelation(value, op0Values[0][0], op1Values[0][0]); ! return new NumberToken( returnValue ); } ! else if ( (op1SizeX == 1) && (op1SizeY == 1) ) { ! // matrix operator scalar // e.g. [2,3,4,5] > 3 ! double[][] returnValues = new double[op0SizeY][op0SizeX]; // Check relation for each element ! for (int yy=0; yy<op0SizeY; yy++) { ! for (int xx=0; xx<op0SizeX; xx++) ! { ! returnValues[yy][xx] = evalRelation(value, ! op0Values[yy][xx], ! op1Values[0][0]); ! } } ! return new NumberToken( returnValues ); } ! else if ( (op0SizeX == 1) && (op0SizeY == 1) ) { ! // scalar operator matrix // e.g. 3 > [2,3,4] ! double[][] returnValues = new double[op1SizeY][op1SizeX]; ! // Check relation for each element ! for (int yy=0; yy<op1SizeY; yy++) ! { ! for (int xx=0; xx<op1SizeX; xx++) ! { ! returnValues[yy][xx] = evalRelation(value, ! op0Values[0][0], ! op1Values[yy][xx]); ! } ! } ! return new NumberToken( returnValues ); } ! else if ( (op0SizeX == op1SizeX) && (op0SizeY == op0SizeY) ) { ! // matrix operator matrix // e.g. [3,3,3] > [2,3,4] ! double[][] returnValues = new double[op1SizeY][op1SizeX]; // Check relation for each element ! for (int yy=0; yy<op1SizeY; yy++) { ! for (int xx=0; xx<op1SizeX; xx++) ! { ! returnValues[yy][xx] = evalRelation(value, ! op0Values[yy][xx], ! op1Values[yy][xx]); ! } } ! return new NumberToken( returnValues ); } else --- 59,127 ---- { // two operands and both a numbers ! // e.g. 2>3, 3>=6, 4!=3, [2,3,4]>3 ! NumberToken num0 = (NumberToken)operands[0]; ! NumberToken num1 = (NumberToken)operands[1]; ! int[] size0 = num0.getSize(); ! int[] size1 = num1.getSize(); ! int n0 = num0.getNumberOfElements(); ! int n1 = num1.getNumberOfElements(); ! ! ! if ( num0.isScalar() && num1.isScalar() ) { ! // <scalar> <operator> <scalar> // e.g. 2!=3, 5>6 ! boolean returnValue = evalRelation(value, ! num0.getValueRe(0), ! num1.getValueRe(0)); ! return new LogicalToken( returnValue ); } ! else if ( num1.isScalar() ) { ! // <array> <operator> <scalar> // e.g. [2,3,4,5] > 3 ! boolean[] returnValues = new boolean[n0]; // Check relation for each element ! for (int i=0; i<n0; i++) { ! returnValues[i] = evalRelation(value, ! num0.getValueRe(i), ! num1.getValueRe(0)); } ! return new LogicalToken(size0, returnValues); ! } ! else if ( num0.isScalar() ) { ! // <scalar> <operator> <array> // e.g. 3 > [2,3,4] ! boolean[] returnValues = new boolean[n1]; ! // Check relation for each element ! for (int i=0; i<n1; i++) ! { ! returnValues[i] = evalRelation(value, ! num0.getValueRe(0), ! num1.getValueRe(i)); ! } ! return new LogicalToken(size1, returnValues); ! } ! else if ( DataToken.checkEqualDimensions(size0, size1) ) { ! // <array> <operator> <array> // e.g. [3,3,3] > [2,3,4] ! boolean[] returnValues = new boolean[n0]; // Check relation for each element ! for (int i=0; i<n0; i++) { ! returnValues[i] = evalRelation(value, ! num0.getValueRe(i), ! num1.getValueRe(i)); } ! return new LogicalToken(size0, returnValues); ! } else *************** *** 129,133 **** // dimensions do not fit // e.g. [2,3]>[2,3,4] ! Errors.throwMathLibException("Relation: dimensions don't fit"); return null; } --- 129,133 ---- // dimensions do not fit // e.g. [2,3]>[2,3,4] ! Errors.throwMathLibException("RelationToken: dimensions don't fit"); return null; } *************** *** 138,152 **** // two operands and both are strings // e.g. 2>3, 3>=6, 4!=3 String op0Values = ((CharToken)operands[0]).getValue(); int op0SizeX = op0Values.length(); String op1Values = ((CharToken)operands[1]).getValue(); int op1SizeX = op1Values.length(); - double[][] returnValues = null; if (op1SizeX == 1) { ! // matrix operator scalar // e.g. 'asdf' != 'd' ! returnValues = new double[1][op0SizeX]; // Check relation for each element --- 138,160 ---- // two operands and both are strings // e.g. 2>3, 3>=6, 4!=3 + CharToken char0 = (CharToken)operands[0]; + CharToken char1 = (CharToken)operands[1]; + int[] size0 = char0.getSize(); + int[] size1 = char1.getSize(); + int n0 = char0.getNumberOfElements(); + int n1 = char1.getNumberOfElements(); + + // !!! changed from x,y to n-d-array + String op0Values = ((CharToken)operands[0]).getValue(); int op0SizeX = op0Values.length(); String op1Values = ((CharToken)operands[1]).getValue(); int op1SizeX = op1Values.length(); if (op1SizeX == 1) { ! // <array> <operator> <scalar> // e.g. 'asdf' != 'd' ! boolean[][] returnValues = new boolean[1][op0SizeX]; // Check relation for each element *************** *** 157,166 **** op1Values.charAt(0)); } } else if (op0SizeX == 1) { ! // matrix operator scalar // e.g. 'asdf' != 'd' ! returnValues = new double[1][op1SizeX]; // Check relation for each element --- 165,175 ---- op1Values.charAt(0)); } + return new LogicalToken( returnValues ); } else if (op0SizeX == 1) { ! // <array> <operator> <scalar> // e.g. 'asdf' != 'd' ! boolean[][] returnValues = new boolean[1][op1SizeX]; // Check relation for each element *************** *** 171,180 **** op1Values.charAt(xx)); } } else if ( op0SizeX == op1SizeX ) { ! // matrix operator scalar // e.g. 'asdf' != 'asdd' ! returnValues = new double[1][op0SizeX]; // Check relation for each element --- 180,190 ---- op1Values.charAt(xx)); } + return new LogicalToken( returnValues ); } else if ( op0SizeX == op1SizeX ) { ! // <array> <operator> <scalar> // e.g. 'asdf' != 'asdd' ! boolean[][] returnValues = new boolean[1][op0SizeX]; // Check relation for each element *************** *** 185,188 **** --- 195,199 ---- op1Values.charAt(xx)); } + return new LogicalToken( returnValues ); } else *************** *** 190,242 **** // dimensions do not fit // e.g. [2,3]>[2,3,4] ! Errors.throwMathLibException("Relation: dimensions don't fit"); } - return new NumberToken( returnValues ); } ! Errors.throwMathLibException("Relation: Token not supported"); return null; } /** evaluate relations (<, >, <=, >=, == ~=) ! @param value = the tpye of operator ! @param arg0 = the left hand operand ! @param arg1 = the right hand operand ! @return the result as a double*/ ! private double evalRelation(char value, double arg0, double arg1) { - switch (value) { case '<': ! if (arg0 < arg1) return 1.0; break; case '>': ! if (arg0 > arg1) return 1.0; break; case 'l': ! if (arg0 <= arg1) return 1.0; break; case 'g': ! if (arg0 >= arg1) return 1.0; break; case 'e': ! if (arg0 == arg1) return 1.0; break; case 'n': ! if (arg0 != arg1) return 1.0; break; case '|': ! if ((arg0!=0.0) || (arg1!=0.0)) return 1.0; break; case 'o': ! if ((arg0!=0.0) || (arg1!=0.0)) return 1.0; break; case '&': ! if ((arg0!=0.0) && (arg1!=0.0)) return 1.0; break; case 'a': ! if ((arg0!=0.0) && (arg1!=0.0)) return 1.0; break; --- 201,252 ---- // dimensions do not fit // e.g. [2,3]>[2,3,4] ! Errors.throwMathLibException("RelationToken: dimensions don't fit"); } } ! Errors.throwMathLibException("RelationToken: Token not supported"); return null; } /** evaluate relations (<, >, <=, >=, == ~=) ! * @param value = the tpye of operator ! * @param arg0 = the left hand operand ! * @param arg1 = the right hand operand ! * @return the result as a double ! */ ! private boolean evalRelation(char value, double arg0, double arg1) { switch (value) { case '<': ! if (arg0 < arg1) return true; break; case '>': ! if (arg0 > arg1) return true; break; case 'l': ! if (arg0 <= arg1) return true; break; case 'g': ! if (arg0 >= arg1) return true; break; case 'e': ! if (arg0 == arg1) return true; break; case 'n': ! if (arg0 != arg1) return true; break; case '|': ! if ((arg0!=0.0) || (arg1!=0.0)) return true; break; case 'o': ! if ((arg0!=0.0) || (arg1!=0.0)) return true; break; case '&': ! if ((arg0!=0.0) && (arg1!=0.0)) return true; break; case 'a': ! if ((arg0!=0.0) && (arg1!=0.0)) return true; break; *************** *** 244,251 **** // relation not true --> return false ! return 0.0; } ! private double evalRelation(char value, char arg0, char arg1) { --- 254,268 ---- // relation not true --> return false ! return false; } ! /** ! * ! * @param value ! * @param arg0 ! * @param arg1 ! * @return ! */ ! private boolean evalRelation(char value, char arg0, char arg1) { *************** *** 263,270 **** break; case 'e': ! if (arg0 == arg1) return 1.0; break; case 'n': ! if (arg0 != arg1) return 1.0; break; --- 280,287 ---- break; case 'e': ! if (arg0 == arg1) return true; break; case 'n': ! if (arg0 != arg1) return true; break; *************** *** 272,279 **** // relation not true --> return false ! return 0.0; } ! /**@return the operator as a string*/ public String toString() { --- 289,299 ---- // relation not true --> return false ! return false; } ! /** ! * ! * @return ! */ public String toString() { *************** *** 302,306 **** return valueString; } - ! } --- 322,325 ---- return valueString; } ! } // end RelationOperatorToken Index: DataToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/DataToken.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** DataToken.java 20 Jan 2007 15:26:33 -0000 1.18 --- DataToken.java 21 Jan 2007 13:30:23 -0000 1.19 *************** *** 58,61 **** --- 58,70 ---- return sizeA; } + + /** + * + * @return + */ + public int getDimensions() + { + return sizeA.length; + } /** *************** *** 69,73 **** ! public boolean checkEqualDimensions(int[] size1, int[] size2) { --- 78,82 ---- ! public static boolean checkEqualDimensions(int[] size1, int[] size2) { |
|
From: Stefan M. <st_...@us...> - 2007-01-21 13:11:46
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv15762/Source/MathLib/Functions Modified Files: FunctionManager.java Log Message: less debugging information Index: FunctionManager.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/FunctionManager.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** FunctionManager.java 13 Jan 2007 10:56:05 -0000 1.51 --- FunctionManager.java 21 Jan 2007 13:07:39 -0000 1.52 *************** *** 111,118 **** String key = (String)entry.getKey(); ! ErrorLogger.debugLine("UserF: " + ! key +" -> ( "+ pathAndFileName +", "+ ! lastModified +" , "+ lastModifiedCheck + ! " -> " + dateChanged + ")" ); // check if date of file in cache and date of file on disc are different --- 111,118 ---- String key = (String)entry.getKey(); ! //ErrorLogger.debugLine("UserF: " + ! // key +" -> ( "+ pathAndFileName +", "+ ! // lastModified +" , "+ lastModifiedCheck + ! // " -> " + dateChanged + ")" ); // check if date of file in cache and date of file on disc are different |
|
From: Stefan M. <st_...@us...> - 2007-01-20 16:11:01
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv5685 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** ChangeLog.txt 20 Jan 2007 15:35:25 -0000 1.155 --- ChangeLog.txt 20 Jan 2007 16:10:57 -0000 1.156 *************** *** 14,18 **** delete.java, det.m, dot.m, eq.m, false.m, gammaln.m, ge.m, gray2ind.m, gray.m, gt.m, ! hankel.m, hurst.m, inf.java, inv.m, isdefinite.m, isdirectory.java, isfile.java, isfinite.java, ishidden.java, islogical.java, isnan.java, isinf.java, issymmetric.m, --- 14,19 ---- delete.java, det.m, dot.m, eq.m, false.m, gammaln.m, ge.m, gray2ind.m, gray.m, gt.m, ! hankel.m, hurst.m, inf.java, inv.m, isa.java, isdefinite.m, isdirectory.java, ! isfile.java, isfinite.java, ishidden.java, islogical.java, isnan.java, isinf.java, issymmetric.m, *************** *** 55,58 **** --- 56,70 ---- stefan + Functions/General/true.m stefan + Functions/General/false.m + stefan + Functions/General/isa.java + stefan + Functions/General/isuint8.m + stefan + Functions/General/isuint16.m + stefan + Functions/General/isuint32.m + stefan + Functions/General/isuint64.m + stefan + Functions/General/isint8.m + stefan + Functions/General/isint16.m + stefan + Functions/General/isint32.m + stefan + Functions/General/isint64.m + stefan + Functions/General/issingle.m + 2007/01/18 |
|
From: Stefan M. <st_...@us...> - 2007-01-20 16:10:05
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv5272/Source/MathLib/Functions/General Added Files: isint32.m isint8.m isint16.m isuint64.m isuint16.m isuint8.m isdouble.m isuint32.m issingle.m isint64.m Log Message: --- NEW FILE: isdouble.m --- function y = isdouble(x) y = isa(x, 'double'); endfunction /* @GROUP general @SYNTAX isdouble(x) @DOC . @EXAMPLES <programlisting> </programlisting> @NOTES . @SEE ischar, iscell, isnumeric, ismatrix, isprime */ --- NEW FILE: isint32.m --- function y = isint32(x) y = isa(x, 'int32'); endfunction /* @GROUP general @SYNTAX isint32(x) @DOC . @EXAMPLES <programlisting> </programlisting> @NOTES . @SEE ischar, iscell, isnumeric, ismatrix, isprime */ --- NEW FILE: isuint64.m --- function y = isuint64(x) y = isa(x, 'uint64'); endfunction /* @GROUP general @SYNTAX isuint64(x) @DOC . @EXAMPLES <programlisting> </programlisting> @NOTES . @SEE ischar, iscell, isnumeric, ismatrix, isprime */ --- NEW FILE: isuint16.m --- function y = isuint16(x) y = isa(x, 'uint16'); endfunction /* @GROUP general @SYNTAX isuint16(x) @DOC . @EXAMPLES <programlisting> </programlisting> @NOTES . @SEE ischar, iscell, isnumeric, ismatrix, isprime */ --- NEW FILE: isint8.m --- function y = isint8(x) y = isa(x, 'int8'); endfunction /* @GROUP general @SYNTAX isint8(x) @DOC . @EXAMPLES <programlisting> </programlisting> @NOTES . @SEE ischar, iscell, isnumeric, ismatrix, isprime */ --- NEW FILE: isuint32.m --- function y = isuint32(x) y = isa(x, 'uint32'); endfunction /* @GROUP general @SYNTAX isuint32(x) @DOC . @EXAMPLES <programlisting> </programlisting> @NOTES . @SEE ischar, iscell, isnumeric, ismatrix, isprime */ --- NEW FILE: isint16.m --- function y = isint16(x) y = isa(x, 'int16'); endfunction /* @GROUP general @SYNTAX isint16(x) @DOC . @EXAMPLES <programlisting> </programlisting> @NOTES . @SEE ischar, iscell, isnumeric, ismatrix, isprime */ --- NEW FILE: issingle.m --- function y = issingle(x) y = isa(x, 'single'); endfunction /* @GROUP general @SYNTAX issingle(x) @DOC . @EXAMPLES <programlisting> </programlisting> @NOTES . @SEE ischar, iscell, isnumeric, ismatrix, isprime */ --- NEW FILE: isint64.m --- function y = isint64(x) y = isa(x, 'int64'); endfunction /* @GROUP general @SYNTAX isint64(x) @DOC . @EXAMPLES <programlisting> </programlisting> @NOTES . @SEE ischar, iscell, isnumeric, ismatrix, isprime */ --- NEW FILE: isuint8.m --- function y = isuint8(x) y = isa(x, 'uint8'); endfunction /* @GROUP general @SYNTAX isuint8(x) @DOC . @EXAMPLES <programlisting> </programlisting> @NOTES . @SEE ischar, iscell, isnumeric, ismatrix, isprime */ |
|
From: Stefan M. <st_...@us...> - 2007-01-20 15:59:28
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv1112/Source/MathLib/Functions/General Added Files: isa.java Log Message: --- NEW FILE: isa.java --- package MathLib.Functions.General; import MathLib.Tokens.Token; import MathLib.Tokens.OperandToken; import MathLib.Tokens.NumberToken; import MathLib.Tokens.DataToken; import MathLib.Tokens.CharToken; import MathLib.Functions.ExternalFunction; public class isa extends ExternalFunction { public OperandToken evaluate(Token[] operands) { if (getNArgIn(operands) != 2) throwMathLibException("isa: number of arguments != 2"); if (!(operands[0] instanceof DataToken)) throwMathLibException("isa: first operand must be a data token"); if (!(operands[1] instanceof CharToken)) throwMathLibException("isa: second operand must be a char token"); String opDataType = ((DataToken)operands[0]).getDataType(); String reqDataType = ((CharToken)operands[1]).getValue(); if (opDataType.compareTo(reqDataType)==0) return NumberToken.one; else return NumberToken.zero; } } /* @GROUP general @SYNTAX isa(value,'class') @DOC . @EXAMPLES <programlisting> a=55 isa(a,'double') -> 1 isa(a,'char') -> 0 </programlisting> @NOTES . @SEE ismatrix, isnumeric, isscalar, issquare, islogical */ |
|
From: Stefan M. <st_...@us...> - 2007-01-20 15:47:20
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28689/Source/MathLib/Functions/General Modified Files: rand.java Log Message: rand(2,3) did not work Index: rand.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/rand.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** rand.java 17 Jan 2007 19:38:01 -0000 1.14 --- rand.java 20 Jan 2007 15:47:15 -0000 1.15 *************** *** 12,18 **** { ! if ( (getNArgIn(operands) < 0) || ! (getNArgIn(operands) > 1) ) ! throwMathLibException("rand: number of arguments <0 or >1 "); // number of arguments --- 12,18 ---- { ! //if ( (getNArgIn(operands) < 0) || ! // (getNArgIn(operands) > 1) ) ! // throwMathLibException("rand: number of arguments <0 or >1 "); // number of arguments |
|
From: Stefan M. <st_...@us...> - 2007-01-20 15:35:28
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23878 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** ChangeLog.txt 20 Jan 2007 15:27:06 -0000 1.154 --- ChangeLog.txt 20 Jan 2007 15:35:25 -0000 1.155 *************** *** 12,16 **** complement.m, cov.m, createnewfile.java, cumprod.java, cumsum.m, create_set.m, conj.java, ! delete.java, det.m, dot.m, eq.m, gammaln.m, ge.m, gray2ind.m, gray.m, gt.m, hankel.m, hurst.m, inf.java, inv.m, isdefinite.m, isdirectory.java, isfile.java, isfinite.java, ishidden.java, islogical.java, isnan.java, isinf.java, --- 12,17 ---- complement.m, cov.m, createnewfile.java, cumprod.java, cumsum.m, create_set.m, conj.java, ! delete.java, det.m, dot.m, eq.m, false.m, gammaln.m, ge.m, gray2ind.m, gray.m, ! gt.m, hankel.m, hurst.m, inf.java, inv.m, isdefinite.m, isdirectory.java, isfile.java, isfinite.java, ishidden.java, islogical.java, isnan.java, isinf.java, *************** *** 24,28 **** repmat.java, rmdir.java, roots.m, save_variables.java, size_equal.m, sort.java, std.m, stril.m, sylvester_matrix.m, toeplitz.m, triangle_lw.m, triangle_sw.m, ! triu.m, var.m, vech.m, wilkinson.m Updated functions: --- 25,29 ---- repmat.java, rmdir.java, roots.m, save_variables.java, size_equal.m, sort.java, std.m, stril.m, sylvester_matrix.m, toeplitz.m, triangle_lw.m, triangle_sw.m, ! triu.m, true.m, var.m, vech.m, wilkinson.m Updated functions: *************** *** 52,55 **** --- 53,58 ---- stefan + Functions/General/logical.java stefan + Tokens/LogicalToken.java + stefan + Functions/General/true.m + stefan + Functions/General/false.m 2007/01/18 |
|
From: Stefan M. <st_...@us...> - 2007-01-20 15:34:22
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23483/Source/MathLib/Functions/General Added Files: true.m false.m Log Message: --- NEW FILE: true.m --- function y = true(varargin) y = logical( ones(varargin{:}) ) endfunction /* @GROUP general @SYNTAX true(x) @DOC . @EXAMPLES <programlisting> true(2) -> [true, true; true true] </programlisting> @NOTES . @SEE false, islogical, logical */ --- NEW FILE: false.m --- function y = false(varargin) y = logical( zeros(varargin{:}) ) endfunction /* @GROUP general @SYNTAX false(x) @DOC . @EXAMPLES <programlisting> false(2) -> [false, false; false, false] </programlisting> @NOTES . @SEE true, islogical, logical */ |
|
From: Stefan M. <st_...@us...> - 2007-01-20 15:27:13
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv20251 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** ChangeLog.txt 20 Jan 2007 10:34:20 -0000 1.153 --- ChangeLog.txt 20 Jan 2007 15:27:06 -0000 1.154 *************** *** 14,19 **** delete.java, det.m, dot.m, eq.m, gammaln.m, ge.m, gray2ind.m, gray.m, gt.m, hankel.m, hurst.m, inf.java, inv.m, isdefinite.m, isdirectory.java, isfile.java, ! isfinite.java, ishidden.java, isnan.java, isinf.java, issymmetric.m, ! lastmodified.java, le.m, loadvariables.java, lookup.m, mean.m, meansq.java, mkdir.java, nan.java, ne.m, nthroot.m, ntsc2rgb.m, nper.m, numel.java, orth.m, pascal.m, perms.m, pmt.m, polyval.m, polyreduce.m, poly.m, print_usage.java, --- 14,21 ---- delete.java, det.m, dot.m, eq.m, gammaln.m, ge.m, gray2ind.m, gray.m, gt.m, hankel.m, hurst.m, inf.java, inv.m, isdefinite.m, isdirectory.java, isfile.java, ! isfinite.java, ishidden.java, islogical.java, isnan.java, isinf.java, ! issymmetric.m, ! lastmodified.java, le.m, loadvariables.java, logical.java, lookup.m, mean.m, ! meansq.java, mkdir.java, nan.java, ne.m, nthroot.m, ntsc2rgb.m, nper.m, numel.java, orth.m, pascal.m, perms.m, pmt.m, polyval.m, polyreduce.m, poly.m, print_usage.java, *************** *** 46,49 **** --- 48,55 ---- stefan + Tokens/NumberTokens/UInt8NumberToken.java preparations for future extensions of the NumberToken + stefan * whos.java added support for all DataToken + stefan + Functions/General/islogical.java + stefan + Functions/General/logical.java + stefan + Tokens/LogicalToken.java 2007/01/18 |
|
From: Stefan M. <st_...@us...> - 2007-01-20 15:26:38
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv19818/Source/MathLib/Tokens Modified Files: DataToken.java VariableToken.java NumberToken.java CellArrayToken.java MathLibObject.java SparseNumberToken.java MatrixToken.java CharToken.java Added Files: LogicalToken.java Log Message: added support on information of the data type Index: MatrixToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/MatrixToken.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** MatrixToken.java 7 Jan 2007 15:42:46 -0000 1.27 --- MatrixToken.java 20 Jan 2007 15:26:33 -0000 1.28 *************** *** 17,21 **** public MatrixToken(OperandToken[][] _value) { ! super(5); //, "MATRIX"); sizeY = _value.length; sizeX = _value[0].length; --- 17,21 ---- public MatrixToken(OperandToken[][] _value) { ! super(5, "matrix"); sizeY = _value.length; sizeX = _value[0].length; *************** *** 27,31 **** public MatrixToken(NumberToken _value) { ! super(5); //, "MATRIX"); sizeY = _value.getSizeY(); sizeX = _value.getSizeX(); --- 27,31 ---- public MatrixToken(NumberToken _value) { ! super(5, "matrix"); sizeY = _value.getSizeY(); sizeX = _value.getSizeX(); Index: VariableToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/VariableToken.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** VariableToken.java 4 Dec 2006 20:16:27 -0000 1.67 --- VariableToken.java 20 Jan 2007 15:26:33 -0000 1.68 *************** *** 35,39 **** public VariableToken(String _name) { ! super(5); //, "VariableToken"); name = _name; fieldName = null; --- 35,39 ---- public VariableToken(String _name) { ! super(5, "variable"); name = _name; fieldName = null; *************** *** 46,50 **** public VariableToken(String _name, String _fieldName) { ! super(5); //, "VariableToken"); name = _name; fieldName = _fieldName; --- 46,50 ---- public VariableToken(String _name, String _fieldName) { ! super(5, "variable"); name = _name; fieldName = _fieldName; *************** *** 58,62 **** public VariableToken(String _name, OperandToken[] _limits) { ! super(5); //, "VariableToken"); name = _name; fieldName = null; --- 58,62 ---- public VariableToken(String _name, OperandToken[] _limits) { ! super(5, "variable"); name = _name; fieldName = null; *************** *** 71,75 **** public VariableToken(String _name, OperandToken[] _limits, String _type) { ! super(5); //, "VariableToken"); name = _name; fieldName = null; --- 71,75 ---- public VariableToken(String _name, OperandToken[] _limits, String _type) { ! super(5, "variable"); name = _name; fieldName = null; Index: DataToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/DataToken.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** DataToken.java 9 Jan 2007 18:58:51 -0000 1.17 --- DataToken.java 20 Jan 2007 15:26:33 -0000 1.18 *************** *** 20,23 **** --- 20,26 ---- protected int noElem; + // name of data type + protected String dataType = "datatoken"; + /**Default Constructor*/ public DataToken() *************** *** 29,35 **** @param _priority - priority of token @param _typeName - the name of the type, used for casting between types*/ ! public DataToken(int _priority) //, String _typeName) { super(_priority); } --- 32,39 ---- @param _priority - priority of token @param _typeName - the name of the type, used for casting between types*/ ! public DataToken(int _priority, String _dataType) { super(_priority); + dataType = _dataType; } *************** *** 82,85 **** --- 86,98 ---- return true; } + + /** + * returns the type of the token's data + * @return + */ + public String getDataType() + { + return dataType; + } //abstract Index: MathLibObject.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/MathLibObject.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** MathLibObject.java 14 Jan 2007 11:32:31 -0000 1.11 --- MathLibObject.java 20 Jan 2007 15:26:33 -0000 1.12 *************** *** 15,19 **** public MathLibObject() { ! super(10); //, "OBJECT"); fields = new HashMap(); --- 15,19 ---- public MathLibObject() { ! super(10, "object"); fields = new HashMap(); --- NEW FILE: LogicalToken.java --- package MathLib.Tokens; import java.text.NumberFormat; import MathLib.Interpreter.ErrorLogger; import MathLib.Interpreter.Errors; import MathLib.Tokens.NumberToken; public class LogicalToken extends DataToken { private boolean values[]; /** * empty logical token * */ public LogicalToken() { dataType = "logical"; sizeY = 0; sizeX = 0; sizeA = new int[]{0,0}; noElem = 0; values = null; } /**Constructor taking the numbers value as a string * @param _real = the numbers real value as a string * @param _imaginary = the numbers imaginary value as a string */ public LogicalToken(String _real) { this(Boolean.getBoolean(_real)); } /**Constructor taking the numbers value as a pair of double * values representing real and imaginary part * @param _real = the numbers real value as a double * @param _imaginary = the numbers imaginary value as a double */ public LogicalToken(double _real) { super(5, "logical"); sizeX = 1; sizeY = 1; sizeA = new int[]{1, 1}; noElem = 1; values = new boolean[1]; if (_real==0) values[0]= true; else values[0]= true; } /** * * @param _value */ public LogicalToken(boolean _value) { super(5, "logical"); sizeX = 1; sizeY = 1; sizeA = new int[]{1, 1}; noElem = 1; values = new boolean[1]; values[0] = _value; } /**Constructor taking the numbers value as two double[][] @param _real = the numbers value as a 2D array of double @param _imaginary = the numbers value as a 2D array of double*/ public LogicalToken(boolean[][] _values) { super(5, "logical"); sizeY = _values.length; sizeX = _values[0].length; sizeA = new int[]{sizeY, sizeX}; noElem = sizeY * sizeX; values = new boolean[noElem]; for(int xx = 0; xx < sizeX; xx++) { for(int yy = 0; yy < sizeY; yy++) { values[xx*sizeY+yy] = _values[yy][xx]; } } } /** * * @param _dy * @param _dx * @param _reValues * @param _imValues */ public LogicalToken(int _dy, int _dx, boolean[] _values) { super(5, "logical"); sizeY = _dy; sizeX = _dx; sizeA = new int[]{sizeY, sizeX}; noElem = sizeY * sizeX; values = new boolean[noElem]; if ((_values != null) && (noElem != _values.length) ) Errors.throwMathLibException("LogicalToken: dimension mismatch"); for(int ni = 0; ni< noElem; ni++) { if (_values != null) values[ni] = _values[ni]; } } /** * Constructor for multidimensional array * @param _sizeA * @param _reValues */ public LogicalToken(int[] _sizeA, boolean[] _values) { super(5, "logical"); sizeA = _sizeA; if (sizeA.length<2) Errors.throwMathLibException("LogicalToken: dimension too low <2"); sizeY = sizeA[0]; sizeX = sizeA[1]; // compute number of elements over all dimensions noElem = 1; for (int i=0; i<sizeA.length; i++) { noElem *= sizeA[i]; } values = new boolean[noElem]; if ((_values != null) && (noElem != _values.length) ) Errors.throwMathLibException("LogicalToken: dimension mismatch"); for(int ni = 0; ni< noElem; ni++) { if (_values != null) values[ni] = _values[ni]; } } /** * Convert y,x points to element number n * @param y * @param x * @return n */ protected int yx2n(int y, int x) { int n = x*sizeY + y; return n; } /*protected int n2y(int n) { int x = (int) (n/sizeY); // column to start int y = n - x*sizeY; // row to start return y; }*/ /*protected int n2x(int n) { int x = (int) (n/sizeY); // column to start return x; }*/ /** * Convert from index to n (e.g. index={2,3,5} -> n) * @param * @return */ public int index2n(int[] index) { String s=""; for (int i=0; i<index.length; i++) s += index[i]+" "; ErrorLogger.debugLine("LogicalToken: index2n: index: "+s); int dn = noElem; int n = 0; for (int i=index.length-1; i>0; i--) { dn = dn / sizeA[i]; n += dn * index[i]; } n+= index[0]; return n; } /** return a new Number Token of size y*x * */ public DataToken getElementSized(int y, int x) { return new NumberToken(y, x, new double[y*x],null); } /** increase/decrease the size of the current NumberToken to size y*x * @param dy number of rows * @param dx number of columns */ public void setSize(int dy, int dx) { boolean[] newValues = new boolean[dy*dx]; ErrorLogger.debugLine("number "+dy+" "+dx); ErrorLogger.debugLine("number "+sizeY+" "+sizeX); // new array must be bigger than original value, otherwise values will be // lost after copying into the new array if ((dy<sizeY) || (dx<sizeX)) Errors.throwMathLibException("LogicalToken: setSize: loosing values"); for(int yy = 0; yy < sizeY; yy++) { for(int xx = 0; xx < sizeX; xx++) { int n = yx2n(yy,xx); ErrorLogger.debugLine("number "+yy+" "+xx); newValues[xx*dy + yy] = values[n]; } } values = newValues; sizeY = dy; sizeX = dx; sizeA = new int[]{sizeY, sizeX}; noElem = sizeY * sizeX; } // end setSize /** * * @param y * @param x * @return */ public OperandToken getElement(int y, int x) { int n = yx2n(y,x); return getElement(n); } /** * * @param n * @return */ public OperandToken getElement(int n) { return new LogicalToken(values[n]); } /** * * @param y * @param x * @param num */ public void setElement(int y, int x, OperandToken num) { int n = yx2n(y,x); setElement(n, num); } /** * * @param n * @param num */ public void setElement(int n, OperandToken num) { values[n] = ((LogicalToken)num).getValue(n); } /** * * @param n * @return */ public boolean getValue(int n) { return values[n]; } /** Set value at position y, x * @param y = y position in matrix * @param x = x position in matrix * @param real = real value * @param imag = imaginary value */ public void setValue(int y, int x, boolean _value) { int n = yx2n(y,x); setValue(n, _value); } /** * * @param n * @param _real * @param _imag */ public void setValue(int n, boolean _value) { values[n] = _value; } /** * * @param index multidimensional index * @param _real * @param _imag */ public void setValue(int[] index, boolean _value) { int n = index2n(index); setValue(n, _value); } /**return the number as a string*/ public String toString() { String result = null; if((sizeY == 0) && (sizeX == 0)) { // e.g. a=null; result = "[]"; } else if((sizeY == 1) && (sizeX == 1) && sizeA.length==2) { // e.g. a=555; result = ""+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]+1); //NOTE: conversion from internal to external index } ret += ") = \n"; ret += toString2d(dim); ret += "\n"; } return ret; } private String toString2d(int[] nn) { 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(values[n]); if(xx < sizeX - 1) buffer.append(" , "); } buffer.append("]\n"); } return buffer.toString(); } /**Evaluate the token. This causes it to return itself*/ public OperandToken evaluate(Token[] operands) { return this; } /**Check if two tokens are equal @param arg = the object to check against*/ public boolean equals(Object arg) { if(arg instanceof LogicalToken) { LogicalToken nArg = (LogicalToken)arg; if(sizeX == nArg.getSizeX() && sizeY == nArg.getSizeY()) { boolean equal = true; for (int yy=0; yy<sizeY && equal; yy++) { for (int xx=0; xx<sizeX && equal; xx++) { int n = yx2n(yy,xx); if(values[n] != nArg.getValue(n)) equal = false; } } return equal; } return false; } return false; } ///////////////////////standard operators/////////////////// //////////////////////////////////////////////////////////// /**add arg to this object for a number token @param = the value to add to it @return the result as an OperandToken*/ /* public OperandToken add(OperandToken arg) { if(!(arg instanceof LogicalToken)) Errors.throwMathLibException("LogicalToken: add: not logical"); LogicalToken nArg = ((LogicalToken)arg); // Check dimensions of matrices if(checkEqualDimensions(sizeA, nArg.sizeA)) { // Add (n*m) + (n*m) or // same dimensions (n,m,r)==(n,m,r) ErrorLogger.debugLine("LogicalToken: add (n*m) + (n*m)"); LogicalToken result = new LogicalToken(sizeA, null); for(int n = 0; n < noElem; n++) { boolean b = getValue(n) | nArg.getValue(n); result.setValue(n, b); } return result; } else if(isScalar()) { // 1 + [3,4,5] ErrorLogger.debugLine("LogicalToken: add (1*1) + (n*m)"); NumberToken result = new NumberToken(nArg.sizeA, null, null); for(int n = 0; n < nArg.getNumberOfElements(); n++) { double realval = getValueRe() + nArg.getValueRe(n); result.setValue(n, realval, imaginaryval); } //ErrorLogger.debugLine("end NumberToken: add (n*m) + (n*m)"); return result; } else if(nArg.isScalar()) { // [3,4,5] +1 ErrorLogger.debugLine("LogicalToken: add (n,m) + (1,1)"); NumberToken result = new NumberToken(sizeA, null, null); for(int n = 0; n < noElem; n++) { double realval = getValueRe(n) + nArg.getValueRe(); result.setValue(n, realval, imaginaryval); } //ErrorLogger.debugLine("end NumberToken: add (n*m) + (n*m)"); return result; } else { // Matrices have unequal size: (n*m) != (o*p) Errors.throwMathLibException("LogicalToken: add matrices of unequal size"); return null; } } // and add */ /**@return true if this number token is a scalar (1*1 matrix)*/ public boolean isScalar() { for (int i=0; i<sizeA.length; i++) { // in case one entry in the size-array is unequal 1 it // is not a scalar any more if (sizeA[i]!=1) return false; } return true; } } // end LogicalToken Index: CharToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/CharToken.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CharToken.java 18 Jan 2007 19:14:00 -0000 1.3 --- CharToken.java 20 Jan 2007 15:26:33 -0000 1.4 *************** *** 9,17 **** private char[][] values; /**Creates a string with a value of _value @param _value = the value of the string*/ public CharToken(String _value) { ! super(99); //, "STRING"); values = new char[1][1]; values[0] = _value.toCharArray(); --- 9,29 ---- private char[][] values; + /**Creates an empty char array + */ + public CharToken() + { + super(99, "char"); + sizeY = 0; + sizeX = 0; + sizeA = new int[]{0, 0}; + noElem = 0; + values = null; + } + /**Creates a string with a value of _value @param _value = the value of the string*/ public CharToken(String _value) { ! super(99, "char"); values = new char[1][1]; values[0] = _value.toCharArray(); *************** *** 26,30 **** public CharToken(char[][] _values) { ! super(99); //, "STRING"); values = _values; sizeY = values.length; --- 38,42 ---- public CharToken(char[][] _values) { ! super(99, "char"); values = _values; sizeY = values.length; *************** *** 38,42 **** public CharToken(char _value) { ! super(99); //, "STRING"); values = new char[1][1]; values[0][0] = _value; --- 50,54 ---- public CharToken(char _value) { ! super(99, "char"); values = new char[1][1]; values[0][0] = _value; Index: CellArrayToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/CellArrayToken.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CellArrayToken.java 18 Jan 2007 19:13:58 -0000 1.10 --- CellArrayToken.java 20 Jan 2007 15:26:33 -0000 1.11 *************** *** 14,18 **** public CellArrayToken() { ! // empty cell array token sizeY = 0; sizeX = 0; --- 14,18 ---- public CellArrayToken() { ! super(5, "cell"); sizeY = 0; sizeX = 0; *************** *** 26,30 **** public CellArrayToken(OperandToken[][] _values) { ! super(5); //, "CELL"); sizeY = _values.length; sizeX = _values[0].length; --- 26,30 ---- public CellArrayToken(OperandToken[][] _values) { ! super(5, "cell"); sizeY = _values.length; sizeX = _values[0].length; *************** *** 38,42 **** public CellArrayToken(OperandToken _value) { ! super(5); //, "CELL"); sizeY = 1; sizeX = 1; --- 38,42 ---- public CellArrayToken(OperandToken _value) { ! super(5, "cell"); sizeY = 1; sizeX = 1; Index: SparseNumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/SparseNumberToken.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SparseNumberToken.java 7 Jan 2007 15:42:46 -0000 1.4 --- SparseNumberToken.java 20 Jan 2007 15:26:33 -0000 1.5 *************** *** 34,46 **** private static final int IMAGINARY = 1; - /**Value used when comparing two numbers - if abs(num2 - num1) <= TOL then num2 equals num1*/ - //private static final double TOL = 0.0000000001; - /** Constructor creating empty number token */ public SparseNumberToken() { ! // empty number token sizeY = 0; sizeX = 0; --- 34,42 ---- private static final int IMAGINARY = 1; /** Constructor creating empty number token */ public SparseNumberToken() { ! super(5, "sparse"); sizeY = 0; sizeX = 0; *************** *** 78,82 **** public SparseNumberToken(String _real, String _imaginary) { ! super(5); //, "NUMBER"); sizeX = 1; sizeY = 1; --- 74,78 ---- public SparseNumberToken(String _real, String _imaginary) { ! super(5, "sparse"); sizeX = 1; sizeY = 1; *************** *** 97,101 **** public SparseNumberToken(double _real, double _imaginary) { ! super(5); //, "NUMBER"); sizeX = 1; sizeY = 1; --- 93,97 ---- public SparseNumberToken(double _real, double _imaginary) { ! super(5, "sparse"); sizeX = 1; sizeY = 1; *************** *** 112,116 **** public SparseNumberToken(double[] _values) { ! super(5); //, "NUMBER"); sizeX = 1; sizeY = 1; --- 108,112 ---- public SparseNumberToken(double[] _values) { ! super(5, "sparse"); sizeX = 1; sizeY = 1; *************** *** 126,130 **** public SparseNumberToken(double[][] _real, double[][] _imaginary) { ! super(5); //, "NUMBER"); sizeY = _real.length; sizeX = _real[0].length; --- 122,126 ---- public SparseNumberToken(double[][] _real, double[][] _imaginary) { ! super(5, "sparse"); sizeY = _real.length; sizeX = _real[0].length; *************** *** 151,155 **** public SparseNumberToken(double[][][] _values) { ! super(5); //, "NUMBER"); sizeY = _values.length; sizeX = _values[0].length; --- 147,151 ---- public SparseNumberToken(double[][][] _values) { ! super(5, "sparse"); sizeY = _values.length; sizeX = _values[0].length; Index: NumberToken.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/NumberToken.java,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** NumberToken.java 18 Jan 2007 19:13:58 -0000 1.103 --- NumberToken.java 20 Jan 2007 15:26:33 -0000 1.104 *************** *** 43,46 **** --- 43,47 ---- { // empty number token + super(5, "double"); sizeY = 0; sizeX = 0; *************** *** 72,76 **** public NumberToken(String _real, String _imaginary) { ! super(5); sizeX = 1; sizeY = 1; --- 73,77 ---- public NumberToken(String _real, String _imaginary) { ! super(5, "double"); sizeX = 1; sizeY = 1; *************** *** 99,103 **** public NumberToken(double _real, double _imaginary) { ! super(5); sizeX = 1; sizeY = 1; --- 100,104 ---- public NumberToken(double _real, double _imaginary) { ! super(5, "double"); sizeX = 1; sizeY = 1; *************** *** 115,119 **** public NumberToken(double[][] _real, double[][] _imaginary) { ! super(5); sizeY = _real.length; sizeX = _real[0].length; --- 116,120 ---- public NumberToken(double[][] _real, double[][] _imaginary) { ! super(5, "double"); sizeY = _real.length; sizeX = _real[0].length; *************** *** 141,145 **** public NumberToken(double[][][] _values) { ! super(5); sizeY = _values.length; sizeX = _values[0].length; --- 142,146 ---- public NumberToken(double[][][] _values) { ! super(5, "double"); sizeY = _values.length; sizeX = _values[0].length; *************** *** 167,171 **** public NumberToken(int _dy, int _dx, double[] _reValues, double[] _imValues) { ! super(5); sizeY = _dy; sizeX = _dx; --- 168,172 ---- public NumberToken(int _dy, int _dx, double[] _reValues, double[] _imValues) { ! super(5, "double"); sizeY = _dy; sizeX = _dx; *************** *** 206,210 **** public NumberToken(int[] _sizeA, double[] _reValues, double[] _imValues) { ! super(5); sizeA = _sizeA; --- 207,211 ---- public NumberToken(int[] _sizeA, double[] _reValues, double[] _imValues) { ! super(5, "double"); sizeA = _sizeA; |
|
From: Stefan M. <st_...@us...> - 2007-01-20 15:24:33
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv19395/Source/MathLib/Functions/General Added Files: logical.java islogical.java Log Message: --- NEW FILE: logical.java --- package MathLib.Functions.General; import MathLib.Tokens.*; import MathLib.Functions.ExternalFunction; public class logical extends ExternalFunction { public OperandToken evaluate(Token[] operands) { if (getNArgIn(operands) != 1 ) throwMathLibException("logical: number of arguments !=1"); if (!(operands[0] instanceof NumberToken)) throwMathLibException("logical: only works on numbers"); NumberToken num = (NumberToken)operands[0]; int[] size = num.getSize(); int n = num.getNumberOfElements(); LogicalToken l = new LogicalToken(size, null); for (int i=0; i<n; i++) { if (num.getValueRe(i)!=0) l.setValue(i, true); else l.setValue(i, false); if (num.getValueIm(i)!=0) throwMathLibException("logical: only works on real numbers"); } return l; } // end eval } /* @GROUP general @SYNTAX logical(x) @DOC converts a double array into an array of boolean @EXAMPLES <programlisting> logical([1,3,0,4]) -> [true, true, false, true] </programlisting> @SEE true, false, islogical */ --- NEW FILE: islogical.java --- package MathLib.Functions.General; import MathLib.Tokens.Token; import MathLib.Tokens.OperandToken; import MathLib.Tokens.NumberToken; import MathLib.Tokens.LogicalToken; import MathLib.Functions.ExternalFunction; /**An external function which checks if the argument is a char*/ public class islogical extends ExternalFunction { public OperandToken evaluate(Token[] operands) { if (getNArgIn(operands) != 1) throwMathLibException("islogical: number of arguments != 1"); if (operands[0] instanceof LogicalToken) return NumberToken.one; else return NumberToken.zero; } } /* @GROUP general @SYNTAX answer = islogical(value) @DOC Returns 1 if the first operand is a logical array, else it returns 0. @EXAMPLES <programlisting> a=logical([1,2,0]) islogical(a) -> 1 </programlisting> @NOTES . @SEE ismatrix, isnumeric, isscalar, issquare */ |
|
From: Stefan M. <st_...@us...> - 2007-01-20 15:23:21
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18897/Source/MathLib/Functions/General Modified Files: whos.java Log Message: added support for all DataTokens by reading the string for data types Index: whos.java =================================================================== RCS file: /cvsroot/mathlib/mathlib/Source/MathLib/Functions/General/whos.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** whos.java 8 Jan 2007 18:56:55 -0000 1.6 --- whos.java 20 Jan 2007 15:23:15 -0000 1.7 *************** *** 27,48 **** // check which type of variable ! 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) ! { ! line += " \t matrix"; ! } ! else if (op instanceof CellArrayToken) { line += getSizeString(op); ! line += " \t cell "; } else --- 27,34 ---- // check which type of variable ! if (op instanceof DataToken) { line += getSizeString(op); ! line += " \t "+ ((DataToken)op).getDataType()+" "; } else |
|
From: Stefan M. <st_...@us...> - 2007-01-20 10:50:39
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/deprecated In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3443/Source/MathLib/Functions/deprecated Added Files: finite.m Log Message: --- NEW FILE: finite.m --- function y = finite(x) y = isfinite(x) endfunction |
|
From: Stefan M. <st_...@us...> - 2007-01-20 10:44:13
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/elfun In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv638/Source/MathLib/Functions/elfun Added Files: secd.m cotd.m cscd.m Log Message: --- NEW FILE: secd.m --- ## Copyright (C) 2006 David Bateman <dba...@fr...> ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} secd (@var{x}) ## Compute the secant of an angle in degrees. ## @seealso{sec, cscd, sind, cosd} ## @end deftypefn function y = secd (x) if (nargin != 1) print_usage (); endif y = 1 ./ cosd (x); endfunction %!error(secd()) %!error(secd(1,2)) %!assert(secd(0:10:80),sec(pi*[0:10:80]/180),-10*eps) %!assert(secd([0,180,360]) != Inf) %!assert(secd([90,270]) == Inf) --- NEW FILE: cscd.m --- ## Copyright (C) 2006 David Bateman <dba...@fr...> ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} cscd (@var{x}) ## Compute the cosecant of an angle in degrees. ## @seealso{csc, secd, sind, cosd} ## @end deftypefn function y = cscd (x) if (nargin != 1) print_usage (); endif y = 1 ./ sind (x); endfunction %!error(cscd()) %!error(cscd(1,2)) %!assert(cscd(10:10:90),csc(pi*[10:10:90]/180),-10*eps) %!assert(cscd([0,180,360]) == Inf) %!assert(cscd([90,270]) != Inf) --- NEW FILE: cotd.m --- ## Copyright (C) 2006 David Bateman <dba...@fr...> ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} cotd (@var{x}) ## Compute the cotangent of an angle in degrees. ## @seealso{cot, tand} ## @end deftypefn function y = cotd (x) if (nargin != 1) print_usage (); endif y = 1 ./ tand (x); endfunction %!error(cotd()) %!error(cotd(1,2)) %!assert(cotd(10:10:80),cot(pi*[10:10:80]/180),-10*eps) %!assert(cotd([0,180,360]) == Inf) %!assert(cotd([90,270]) == 0) |
|
From: Stefan M. <st_...@us...> - 2007-01-20 10:39:27
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/elfun In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv31081/Source/MathLib/Functions/elfun Added Files: asind.m atand.m asecd.m Log Message: --- NEW FILE: asecd.m --- ## Copyright (C) 2006 David Bateman <dba...@fr...> ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} asecd (@var{x}) ## Compute inverse secant in degrees. ## @seealso{asec, secd, acscd} ## @end deftypefn function y = asecd (x) if (nargin != 1) print_usage (); endif y = asec (x) .* 180 ./ pi; endfunction; %!error(asecd()) %!error(asecd(1,2)) %!assert(asecd(0:10:90),180./pi.*asec(0:10:90),-10*eps) --- NEW FILE: atand.m --- ## Copyright (C) 2006 David Bateman <dba...@fr...> ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} atand (@var{x}) ## Compute the inverse tangent of an angle in degrees. ## @seealso{acot, tand} ## @end deftypefn function y = atand (x) if (nargin != 1) print_usage (); endif y = 180 ./ pi .* atan (x); endfunction %!error(atand()) %!error(atand(1,2)) %!assert(atand(0:10:90),180./pi.*atan(0:10:90),-10*eps) --- NEW FILE: asind.m --- ## Copyright (C) 2006 David Bateman <dba...@fr...> ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} asind (@var{x}) ## Compute the inverse sine of an angle in degrees. ## @seealso{asin, sind, acosd} ## @end deftypefn function y = asind (x) if (nargin != 1) print_usage (); endif y = asin(x) .* 180 ./ pi; endfunction %!error(asind()) %!error(asind(1,2)) %!assert(asind(0:0.1:1),180/pi*asin(0:0.1:1),-10*eps) |
|
From: Stefan M. <st_...@us...> - 2007-01-20 10:39:05
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/elfun In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv30704/Source/MathLib/Functions/elfun Added Files: acotd.m acosd.m acscd.m Log Message: --- NEW FILE: acscd.m --- ## Copyright (C) 2006 David Bateman <dba...@fr...> ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} acscd (@var{x}) ## Compute the inverse cosecant of an angle in degrees. ## @seealso{acsc, cscd, asecd} ## @end deftypefn function y = acscd (x) if (nargin != 1) print_usage (); endif y = acsc(x) .* 180 ./ pi; endfunction %!error(acscd()) %!error(acscd(1,2)) %!assert(acscd(0:10:90),180/pi*acsc(0:10:90),-10*eps) --- NEW FILE: acotd.m --- ## Copyright (C) 2006 David Bateman <dba...@fr...> ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} acotd (@var{x}) ## Compute the inverse cotangent of an angle in degrees. ## @seealso{atan, tand} ## @end deftypefn function y = acotd (x) if (nargin != 1) print_usage (); endif y = atand (1 ./ x); endfunction %!error(acotd()) %!error(acotd(1,2)) %!assert(acotd(0:10:90),180./pi.*acot(0:10:90),-10*eps) --- NEW FILE: acosd.m --- ## Copyright (C) 2006 David Bateman <dba...@fr...> ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} acosd (@var{x}) ## Compute the inverse cosine of an angle in degrees. ## @seealso{acos, cosd, asecd} ## @end deftypefn function y = acosd (x) if (nargin != 1) print_usage (); endif y = acos(x) .* 180 ./ pi; endfunction %!error(acosd()) %!error(acosd(1,2)) %!assert(acosd(0:0.1:1),180/pi*acos(0:0.1:1),-10*eps) |
|
From: Stefan M. <st_...@us...> - 2007-01-20 10:38:58
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Functions/elfun In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv30693/Source/MathLib/Functions/elfun Log Message: Directory /cvsroot/mathlib/mathlib/Source/MathLib/Functions/elfun added to the repository |
|
From: Stefan M. <st_...@us...> - 2007-01-20 10:34:23
|
Update of /cvsroot/mathlib/mathlib In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28777 Modified Files: ChangeLog.txt Log Message: Index: ChangeLog.txt =================================================================== RCS file: /cvsroot/mathlib/mathlib/ChangeLog.txt,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** ChangeLog.txt 18 Jan 2007 19:36:56 -0000 1.152 --- ChangeLog.txt 20 Jan 2007 10:34:20 -0000 1.153 *************** *** 34,37 **** --- 34,50 ---- stefan * + 2007/01/20 + stefan + Tokens/NumberTokens/DoubleNumberToken.java + stefan + Tokens/NumberTokens/Int16NumberToken.java + stefan + Tokens/NumberTokens/Int32NumberToken.java + stefan + Tokens/NumberTokens/Int64NumberToken.java + stefan + Tokens/NumberTokens/Int8NumberToken.java + stefan + Tokens/NumberTokens/SingleNumberToken.java + stefan + Tokens/NumberTokens/UInt16NumberToken.java + stefan + Tokens/NumberTokens/UInt32NumberToken.java + stefan + Tokens/NumberTokens/UInt64NumberToken.java + stefan + Tokens/NumberTokens/UInt8NumberToken.java preparations for future + extensions of the NumberToken + 2007/01/18 stefan * Tokens/CellArrayToken.java added better support for empty constructor |
|
From: Stefan M. <st_...@us...> - 2007-01-20 10:33:47
|
Update of /cvsroot/mathlib/mathlib/Source/MathLib/Tokens/NumberTokens In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28611/Source/MathLib/Tokens/NumberTokens Added Files: UInt32NumberToken.java Int16NumberToken.java UInt8NumberToken.java Int64NumberToken.java SingleNumberToken.java DoubleNumberToken.java UInt16NumberToken.java UInt64NumberToken.java Int8NumberToken.java Int32NumberToken.java Log Message: preparations for extensions of the number token --- NEW FILE: UInt32NumberToken.java --- package MathLib.Tokens.NumberTokens; import MathLib.Tokens.NumberToken; public class UInt32NumberToken extends NumberToken { } // end UInt32NumberToken --- NEW FILE: UInt16NumberToken.java --- package MathLib.Tokens.NumberTokens; import MathLib.Tokens.NumberToken; public class UInt16NumberToken extends NumberToken { } // end UInt16NumberToken --- NEW FILE: Int32NumberToken.java --- package MathLib.Tokens.NumberTokens; import MathLib.Tokens.NumberToken; public class Int32NumberToken extends NumberToken { } // end Int32NumberToken --- NEW FILE: Int8NumberToken.java --- package MathLib.Tokens.NumberTokens; import MathLib.Tokens.NumberToken; public class Int8NumberToken extends NumberToken { } // end Int8NumberToken --- NEW FILE: DoubleNumberToken.java --- package MathLib.Tokens.NumberTokens; import MathLib.Tokens.NumberToken; public class DoubleNumberToken extends NumberToken { } // end DoubleNumberToken --- NEW FILE: UInt64NumberToken.java --- package MathLib.Tokens.NumberTokens; import MathLib.Tokens.NumberToken; public class UInt64NumberToken extends NumberToken { } // end UInt64NumberToken --- NEW FILE: UInt8NumberToken.java --- package MathLib.Tokens.NumberTokens; import MathLib.Tokens.NumberToken; public class UInt8NumberToken extends NumberToken { } // end Int8NumberToken --- NEW FILE: Int16NumberToken.java --- package MathLib.Tokens.NumberTokens; import MathLib.Tokens.NumberToken; public class Int16NumberToken extends NumberToken { } // end Int16NumberToke --- NEW FILE: Int64NumberToken.java --- package MathLib.Tokens.NumberTokens; import MathLib.Tokens.NumberToken; public class Int64NumberToken extends NumberToken { } // end Int64NumberToken --- NEW FILE: SingleNumberToken.java --- package MathLib.Tokens.NumberTokens; import MathLib.Tokens.NumberToken; public class SingleNumberToken extends NumberToken { } // end SingleNumberToken |