Skip to content

Commit 12822bc

Browse files
unknownOpenModelica-Hudson
authored andcommitted
updated numeric bindings
1 parent fd0d73b commit 12822bc

File tree

546 files changed

+116106
-21847
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

546 files changed

+116106
-21847
lines changed

SimulationRuntime/cpp/Include/Core/Utils/numeric/LICENSE_1_0.txt

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
//
2+
// Copyright (c) 2009 by Rutger ter Borg
3+
//
4+
// Distributed under the Boost Software License, Version 1.0.
5+
// (See accompanying file LICENSE_1_0.txt or copy at
6+
// http://www.boost.org/LICENSE_1_0.txt)
7+
//
8+
9+
#ifndef BOOST_NUMERIC_BINDINGS_INDEX_HPP
10+
#define BOOST_NUMERIC_BINDINGS_INDEX_HPP
11+
12+
#include <boost/mpl/if.hpp>
13+
#include <boost/mpl/max.hpp>
14+
#include <Core/Utils/numeric/bindings/rank.hpp>
15+
#include <Core/Utils/numeric/bindings/is_column_major.hpp>
16+
17+
namespace boost {
18+
namespace numeric {
19+
namespace bindings {
20+
21+
template< typename T >
22+
struct addressing_index_minor {
23+
typedef typename mpl::if_<
24+
is_column_major< T >,
25+
tag::addressing_index<1>,
26+
tag::addressing_index<
27+
mpl::max< tag::matrix, rank< T > >::type::value
28+
>
29+
>::type type;
30+
};
31+
32+
template< typename T >
33+
struct addressing_index_major {
34+
typedef typename mpl::if_<
35+
is_column_major< T >,
36+
tag::addressing_index<
37+
mpl::max< tag::matrix, rank< T > >::type::value
38+
>,
39+
tag::addressing_index<1>
40+
>::type type;
41+
};
42+
43+
44+
template< typename AddressingIndex, typename TransTag >
45+
struct addressing_index_trans {
46+
typedef AddressingIndex type;
47+
};
48+
49+
template<>
50+
struct addressing_index_trans< tag::addressing_index<1>, tag::transpose > {
51+
typedef tag::addressing_index<2> type;
52+
};
53+
54+
template<>
55+
struct addressing_index_trans< tag::addressing_index<1>, tag::conjugate > {
56+
typedef tag::addressing_index<2> type;
57+
};
58+
59+
template<>
60+
struct addressing_index_trans< tag::addressing_index<2>, tag::transpose > {
61+
typedef tag::addressing_index<1> type;
62+
};
63+
64+
template<>
65+
struct addressing_index_trans< tag::addressing_index<2>, tag::conjugate > {
66+
typedef tag::addressing_index<1> type;
67+
};
68+
69+
70+
} // namespace bindings
71+
} // namespace numeric
72+
} // namespace boost
73+
74+
#endif

SimulationRuntime/cpp/Include/Core/Utils/numeric/bindings/amos/amos.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

SimulationRuntime/cpp/Include/Core/Utils/numeric/bindings/amos/amos.hpp

Lines changed: 0 additions & 87 deletions
This file was deleted.

SimulationRuntime/cpp/Include/Core/Utils/numeric/bindings/amos/amos_names.h

Lines changed: 0 additions & 26 deletions
This file was deleted.

SimulationRuntime/cpp/Include/Core/Utils/numeric/bindings/amos/amos_overloads.hpp

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
//
2+
// Copyright (c) 2009 Rutger ter Borg
3+
//
4+
// Distributed under the Boost Software License, Version 1.0.
5+
// (See accompanying file LICENSE_1_0.txt or copy at
6+
// http://www.boost.org/LICENSE_1_0.txt)
7+
//
8+
9+
#ifndef BOOST_NUMERIC_BINDINGS_AT_HPP
10+
#define BOOST_NUMERIC_BINDINGS_AT_HPP
11+
12+
#include <Core/Utils/numeric/bindings/detail/offset.hpp>
13+
14+
namespace boost {
15+
namespace numeric {
16+
namespace bindings {
17+
namespace detail {
18+
19+
template< typename T, typename Enable = void >
20+
struct at_impl {
21+
22+
typedef typename bindings::value_type<T>::type& result_type;
23+
24+
// TODO implement other array structures such as triangular, band, etc.
25+
static result_type invoke( T& t, const std::ptrdiff_t i1, std::ptrdiff_t i2 ) {
26+
return t( i1, i2 );
27+
}
28+
29+
};
30+
31+
template< typename T >
32+
struct at_impl< T, typename boost::enable_if< bindings::has_linear_array<T> >::type > {
33+
34+
typedef typename bindings::value_type<T>::type& result_type;
35+
36+
static result_type invoke( T& t, const std::ptrdiff_t i1 ) {
37+
return *( bindings::begin_value(t) + offset(t,i1) );
38+
}
39+
40+
static result_type invoke( T& t, const std::ptrdiff_t i1, std::ptrdiff_t i2 ) {
41+
return *( bindings::begin_value(t) + offset(t,i1,i2) );
42+
}
43+
44+
};
45+
46+
}
47+
48+
namespace result_of {
49+
50+
template< typename T >
51+
struct at {
52+
typedef typename detail::at_impl<T>::result_type type;
53+
};
54+
55+
}
56+
57+
template< typename T >
58+
typename result_of::at<T>::type at( T& t, const std::ptrdiff_t i1 ) {
59+
return detail::at_impl<T>::invoke( t, i1 );
60+
}
61+
62+
template< typename T >
63+
typename result_of::at<T>::type at( T& t, const std::ptrdiff_t i1, const std::ptrdiff_t i2 ) {
64+
return detail::at_impl<T>::invoke( t, i1, i2 );
65+
}
66+
67+
} // bindings
68+
} // numeric
69+
} // boost
70+
71+
#endif

0 commit comments

Comments
 (0)