Commit Graph

35 Commits

Author SHA1 Message Date
Joe Crop
42d8fea8c6 logic toolbox with logic functions 2022-12-05 20:07:45 -08:00
Gabriel Ozouf
52dcd8e749 [poincare/unit] Restructure Unit
1. Information about a unit's dimension now uses inheritance.
   _m is an instance of DistanceAlias, which is derived from Alias.
   A UnitNode now keeps a pointer to an Alias and one to a Prefix.
   All aliases are still defined as constexpr.
   This cleans up a lot of the code used namely for computing the
   additional outputs in Calculation.

2. Instead of being defined with a string, each unit is described by its
   ratio with the base SI unit (ex: _L is 0.001 instead of "0.001_m^3").
   This greatly speeds up the calculations using units, as the algorithm
   to find the best unit used to parse the definition.

Change-Id: I4d6ed6ad4cb967026a3f01a335aec270066e2b9f
2020-11-04 15:11:45 +01:00
Gabriel Ozouf
e48e826536 [poincare/test] Updated tests on units
Change-Id: I7c146174bcedcccc3ed31a298c9720aa2a5ba3a9
2020-11-04 15:11:45 +01:00
Hugo Saint-Vignes
8d2af7e77f [poincare/test] Add VectorOperation tests, tidy rref tests
Change-Id: I4072bee6b2d3bf1ad17045149bff8dcdb6a2f238
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
cafb1c1c05 [poincare] LCM and GCD accept set of numbers
Change-Id: I367ff5e48fa2856e976aa020ac0d172216f3a421
2020-11-04 15:11:43 +01:00
Hugo Saint-Vignes
3bfc0c83d8 [poincare] Factorize Echelon Form classes
Change-Id: I7ec7290a4d94b9bd1224ad4c53be8b4662bd32d5
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
007c38652f [poincare] Add ref and rref matrix functions
Change-Id: Id0e57a4f85d551ca5320c4b6e3c0baadae70946d
2020-11-04 15:07:20 +01:00
Émilie Feral
a48f65ba95 [poincare] Unit: ensure one unique instance of each prefix 2020-06-04 14:50:07 +02:00
Émilie Feral
56c45d1390 [poincare] Parsing: expression -> expression is always parsed but return
"undef" when the left expression is neither a custom variable or
function nor a unit.
This makes the behaviour consistent on theses expressions:
2 -> a+a
2 -> 2*a
2020-06-04 14:50:01 +02:00
Romain Goyet
807dd73e7b [poincare] Use a Tuple instead of an ArrayBuilder for expression
The Tuple is simply an initializer_list along with a convenience method
to cast between a list of TreeHandle and a list of Expression
2020-04-10 13:35:14 -04:00
Léa Saviot
a06660ee25 [poincare/vert_off_lay] Subscript layout serializes without _
This way there is no parsing confusion when copy pasting the subscript of
a subscript layout
2020-03-02 09:55:11 +01:00
Ruben Dashyan
1e3b8581e5 [poincare/unit] Lighten Representative constructor 2020-02-12 15:13:26 +01:00
Ruben Dashyan
ca50e764a5 [poincare/test] Test the presence of units as Expression children 2020-02-12 15:13:25 +01:00
Léa Saviot
b2a37cfd3e [poincare] Fix tests 2020-02-12 15:13:25 +01:00
Léa Saviot
1e3294139d [poincare/parser] 0→0→c should not be parsable 2020-02-12 15:13:25 +01:00
Léa Saviot
b93277bb7b [poincare/test] Fix tests
Unparsable tests are now parsable but return undef at the simplification
2020-02-12 15:13:25 +01:00
Émilie Feral
5cb26b19a5 [poincare] Parsing: Unit token does not accept '_' char except at first
position. This enables to parse "_km_s" as Multiplication(Unit(km),
Unit(s))
2020-02-12 15:13:25 +01:00
Émilie Feral
f91ca59ca3 [poincare] Test: call Expression::Parse instead of creating a parser
object everytime we need to parse something
2020-02-12 15:13:24 +01:00
Léa Saviot
8a0e5403ae [poincare/test] Add unit conversion tests 2020-02-12 15:13:24 +01:00
Ruben Dashyan
ab836c7a01 [poincare/unit] Distinguish prefixability of units at input and output 2020-02-12 15:13:23 +01:00
Ruben Dashyan
e6009250de [poincare/test/parsing] Fix Parser usage 2020-02-12 15:13:23 +01:00
Émilie Feral
ba4f9297d4 [poincare] Test: add parsing tests for units 2020-02-12 15:13:23 +01:00
Ruben Dashyan
97508c155c [poincare/test/parsing] Test parsing of unit symbols 2020-02-12 15:13:22 +01:00
Léa Saviot
78adca7113 [poincare/tests] Fix tests after parsing change 2020-02-12 15:13:21 +01:00
Léa Saviot
756eeeb2d8 [poincare/parser] Add context 2020-02-12 15:13:21 +01:00
Émilie Feral
7209265254 [poincare] Parser: forbid parsing 0xABCF as 0xABC*F 2020-02-12 15:13:19 +01:00
Émilie Feral
30c4e01737 [poincare] Fix and add tests about BasedInteger 2020-02-12 15:13:19 +01:00
Ruben Dashyan
3271fc90a4 [poincare/test] Clean header inclusions 2020-02-12 15:13:16 +01:00
Émilie Feral
fbbc11cf33 [poincare] Fix childNeedsUserParentheses with Conjugate expressions 2019-08-16 16:16:53 +02:00
Émilie Feral
4052a047ba [poincare] Add test about addMissingParentheses 2019-08-09 13:22:46 +02:00
Émilie Feral
9fbec16db4 [poincare] Merge MultiplicationImplicit and MultiplicationExplicit (they
were required if we wanted to parse into two distincts expression 2π and
2*π but don't)
2019-08-08 17:22:05 +02:00
Émilie Feral
073479b9aa [poincare] MultiplicationImplicit: MultiplicationImplicit(2^3,4)
seriliazes to [2^3]4. Add tests about expression serialization
2019-08-08 17:22:05 +02:00
Émilie Feral
092fe44dd7 [poincare] Fix text with new Addition and Multiplication 2019-08-08 17:22:04 +02:00
Émilie Feral
c1cd0302b8 [poincare] Fix typo: explicite --> explicit, implicite --> implicit 2019-08-08 17:22:04 +02:00
Émilie Feral
cedcab21ec [poincare] Tidy tests and add TODO for tests that need to be completed 2019-08-08 17:22:04 +02:00