In current model of library matrix support can be addedd easily like every matrix can be treated as operand or argument in case of function. Operations on matrix can be performed using third party libraries such as JAMA and EJML etc.
Here is a copy of a discussion I had with the author of the initial post:
I want to use string representation for matrix For example this expression given by user "2+3*6*[[1,2,3],[4,5,6]]-9" in current implementation "+", " -", "/", "%", "(", ")" and "," are used as token delimiter. When first time toValue() is called it will pass "2" then "3" and then "6" after that it will give "[[1" because comma(,) is delimiter so it tokenize but It should pass the complete matrix "[[1,2,3],[4,5,6]]". When matrix is in this format "[[1 2 3][4 5 6]]" complete matrix is passed by toValue() function because this syntax of matrix does not contain any delimiter. But I can't use this syntax because my matrix may contain complex number like "2+3i" and may contain expression at any index. So what I want is that when toValue() function is called it should pass complete matrix instead of delimited matrix at delimiter within matrix. I am trying to add this functionality by my own but having hard time in understanding the flow of library. I would be very grateful if you add this functionality to library or tell me the flow of library. Thanks in advance for help.
Last edit: Fathzer 2015-10-06
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
My understanding is the problem you have is '+' is not a token delimiter when it is included in brackets.
The default tokenize mechanism is not able to deal with that case. Hopefully, you can override the AbstractEvaluator.tokenize(String) method. Here is a quick and dirty implementation. Maybe you should improve it using regular expressions.
Here is a copy of a discussion I had with the author of the initial post:
I want to use string representation for matrix For example this expression given by user "
2+3*6*[[1,2,3],[4,5,6]]-9" in current implementation "+", " -", "/", "%", "(", ")" and "," are used as token delimiter. When first time toValue() is called it will pass "2" then "3" and then "6" after that it will give "[[1" because comma(,) is delimiter so it tokenize but It should pass the complete matrix "[[1,2,3],[4,5,6]]". When matrix is in this format "[[1 2 3][4 5 6]]
" complete matrix is passed by toValue() function because this syntax of matrix does not contain any delimiter. But I can't use this syntax because my matrix may contain complex number like "2+3i" and may contain expression at any index. So what I want is that when toValue() function is called it should pass complete matrix instead of delimited matrix at delimiter within matrix. I am trying to add this functionality by my own but having hard time in understanding the flow of library. I would be very grateful if you add this functionality to library or tell me the flow of library. Thanks in advance for help.Last edit: Fathzer 2015-10-06
Hi,
My understanding is the problem you have is '+' is not a token delimiter when it is included in brackets.
The default tokenize mechanism is not able to deal with that case. Hopefully, you can override the AbstractEvaluator.tokenize(String) method. Here is a quick and dirty implementation. Maybe you should improve it using regular expressions.
Best regards
Jean-Marc Astesana
Last edit: Fathzer 2015-10-06
View and moderate all "tickets Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Tickets"
Thank you very much :-)