Skip to content

Commit

Permalink
Complete refactorization of simplification rules during the evaluatio…
Browse files Browse the repository at this point in the history
…n of addition_t and product_t.
  • Loading branch information
laffernandes committed Feb 17, 2019
1 parent 3f8d27b commit b74b0f5
Show file tree
Hide file tree
Showing 549 changed files with 1,081 additions and 38,542 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
/cpp/build/vc2017/example
/cpp/tools/example/build
/cpp/tools/test/build
/.vscode
/cpp/tools/example/.vscode
8 changes: 4 additions & 4 deletions gpl-3.0.txt → LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
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, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
5 changes: 3 additions & 2 deletions cpp/include/ga/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ namespace ga {

using grade_t = default_integral_t;

using index_t = std::uint32_t;
using ndims_t = std::uint32_t;
using index_t = std::uint64_t;
using ndims_t = std::uint64_t;

template<typename ValueType>
using associative_container_t = std::map<bitset_t, ValueType>;
Expand All @@ -76,6 +76,7 @@ namespace ga {

#include "ga/core/mapping.hpp"

#include "ga/core/rules.hpp"
#include "ga/core/expression_relational_operators.hpp"
#include "ga/core/expression_addition.hpp"
#include "ga/core/expression_product.hpp"
Expand Down
617 changes: 480 additions & 137 deletions cpp/include/ga/core/expression_addition.hpp

Large diffs are not rendered by default.

679 changes: 517 additions & 162 deletions cpp/include/ga/core/expression_product.hpp

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions cpp/include/ga/core/rules.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
Copyright (C) 2018 Leandro Augusto Frata Fernandes
author : Fernandes, Leandro A. F.
e-mail : [email protected]
home page : http://www.ic.uff.br/~laffernandes
repository : https://github.com/laffernandes/gatl.git
This file is part of The Geometric Algebra Template Library (GATL).
GATL 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 3 of the License, or
(at your option) any later version.
GATL 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 GATL. If not, see <https://www.gnu.org/licenses/>.
/**/

#ifndef __GA_CORE_RULES_HPP__
#define __GA_CORE_RULES_HPP__

namespace ga {

namespace detail {

// An identity type trait used by get_rule_for<...> to avoid evaluating all rules in a given rules<...> list.
template<typename Type>
struct identity {
using type = Type;
};

// A list of simplification rules that must be applied in the given order.
template<typename... Rules>
struct rules {
};

// Look for a rule attending the given arguments.
template<typename Rules, typename... Arguments>
struct get_rule_for;

template<typename Rules, typename... Arguments>
using get_rule_for_t = typename get_rule_for<Rules, Arguments...>::type;

template<typename Rule, typename... NextRules, typename... Arguments>
struct get_rule_for<rules<Rule, NextRules...>, Arguments...> {
using type = typename std::conditional_t<
Rule::template condition<Arguments...>::value,
identity<Rule>,
get_rule_for<rules<NextRules...>, Arguments...>
>::type;
};

template<typename Rule, typename... Arguments>
struct get_rule_for<rules<Rule>, Arguments...> {
using type = std::conditional_t<
Rule::template condition<Arguments...>::value,
Rule,
nullptr_t // It should be impossible to reach this case
>;
};

// Look for a rule attending the given arguments and apply it, returning the resulting type.
template<typename Rules, typename... Arguments>
using apply_rule_for_t = typename get_rule_for_t<Rules, Arguments...>::template result<Arguments...>::type;
}

}

#endif // __GA_CORE_RULES_HPP__
44 changes: 0 additions & 44 deletions gatl-1.0/CMake-MSVC-90.bat

This file was deleted.

40 changes: 0 additions & 40 deletions gatl-1.0/CMakeTemplateConfig.cmake

This file was deleted.

43 changes: 0 additions & 43 deletions gatl-1.0/CMakeTemplateExport.cmake

This file was deleted.

15 changes: 0 additions & 15 deletions gatl-1.0/CMakeTemplateInstall.cmake

This file was deleted.

25 changes: 0 additions & 25 deletions gatl-1.0/CMakeTemplateUse.cmake

This file was deleted.

59 changes: 0 additions & 59 deletions gatl-1.0/bmathlib/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit b74b0f5

Please sign in to comment.