mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-08 09:49:03 +08:00
Remove dead code
This commit is contained in:
parent
f3ccbe0419
commit
e84ed7b6ef
@ -318,120 +318,6 @@ struct get_compile_time_incr<ArithmeticSequence<FirstType,SizeType,IncrType> > {
|
|||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace legacy {
|
|
||||||
// Here are some initial code that I keep here for now to compare the quality of the code generated by the compilers
|
|
||||||
// This part will be removed once we have checked everything is right.
|
|
||||||
|
|
||||||
struct shifted_last {
|
|
||||||
explicit shifted_last(int o) : offset(o) {}
|
|
||||||
int offset;
|
|
||||||
shifted_last operator+ (int x) const { return shifted_last(offset+x); }
|
|
||||||
shifted_last operator- (int x) const { return shifted_last(offset-x); }
|
|
||||||
int operator- (shifted_last x) const { return offset-x.offset; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct last_t {
|
|
||||||
last_t() {}
|
|
||||||
shifted_last operator- (int offset) const { return shifted_last(-offset); }
|
|
||||||
shifted_last operator+ (int offset) const { return shifted_last(+offset); }
|
|
||||||
int operator- (last_t) const { return 0; }
|
|
||||||
int operator- (shifted_last x) const { return -x.offset; }
|
|
||||||
};
|
|
||||||
static const last_t last;
|
|
||||||
|
|
||||||
|
|
||||||
struct shifted_end {
|
|
||||||
explicit shifted_end(int o) : offset(o) {}
|
|
||||||
int offset;
|
|
||||||
shifted_end operator+ (int x) const { return shifted_end(offset+x); }
|
|
||||||
shifted_end operator- (int x) const { return shifted_end(offset-x); }
|
|
||||||
int operator- (shifted_end x) const { return offset-x.offset; }
|
|
||||||
};
|
|
||||||
|
|
||||||
struct end_t {
|
|
||||||
end_t() {}
|
|
||||||
shifted_end operator- (int offset) const { return shifted_end (-offset); }
|
|
||||||
shifted_end operator+ (int offset) const { return shifted_end ( offset); }
|
|
||||||
int operator- (end_t) const { return 0; }
|
|
||||||
int operator- (shifted_end x) const { return -x.offset; }
|
|
||||||
};
|
|
||||||
static const end_t end;
|
|
||||||
|
|
||||||
inline Index eval_expr_given_size(last_t, Index size) { return size-1; }
|
|
||||||
inline Index eval_expr_given_size(shifted_last x, Index size) { return size+x.offset-1; }
|
|
||||||
inline Index eval_expr_given_size(end_t, Index size) { return size; }
|
|
||||||
inline Index eval_expr_given_size(shifted_end x, Index size) { return size+x.offset; }
|
|
||||||
|
|
||||||
template<typename FirstType=Index,typename LastType=Index,typename IncrType=internal::fix_t<1> >
|
|
||||||
class ArithmeticSequenceProxyWithBounds
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ArithmeticSequenceProxyWithBounds(FirstType f, LastType l) : m_first(f), m_last(l) {}
|
|
||||||
ArithmeticSequenceProxyWithBounds(FirstType f, LastType l, IncrType s) : m_first(f), m_last(l), m_incr(s) {}
|
|
||||||
|
|
||||||
enum {
|
|
||||||
SizeAtCompileTime = -1,
|
|
||||||
IncrAtCompileTime = internal::get_fixed_value<IncrType,DynamicIndex>::value
|
|
||||||
};
|
|
||||||
|
|
||||||
Index size() const { return (m_last-m_first+m_incr)/m_incr; }
|
|
||||||
Index operator[](Index i) const { return m_first + i * m_incr; }
|
|
||||||
Index first() const { return m_first; }
|
|
||||||
|
|
||||||
const FirstType& firstObject() const { return m_first; }
|
|
||||||
const LastType& lastObject() const { return m_last; }
|
|
||||||
const IncrType& incrObject() const { return m_incr; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
FirstType m_first;
|
|
||||||
LastType m_last;
|
|
||||||
IncrType m_incr;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename FirstType,typename LastType>
|
|
||||||
ArithmeticSequenceProxyWithBounds<typename internal::cleanup_index_type<FirstType>::type,typename internal::cleanup_index_type<LastType>::type >
|
|
||||||
seq(FirstType f, LastType l) {
|
|
||||||
return ArithmeticSequenceProxyWithBounds<typename internal::cleanup_index_type<FirstType>::type,typename internal::cleanup_index_type<LastType>::type>(f,l);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename FirstType,typename LastType,typename IncrType>
|
|
||||||
ArithmeticSequenceProxyWithBounds< typename internal::cleanup_index_type<FirstType>::type,
|
|
||||||
typename internal::cleanup_index_type<LastType>::type,
|
|
||||||
typename internal::cleanup_seq_incr<IncrType>::type >
|
|
||||||
seq(FirstType f, LastType l, IncrType s)
|
|
||||||
{
|
|
||||||
return ArithmeticSequenceProxyWithBounds<typename internal::cleanup_index_type<FirstType>::type,
|
|
||||||
typename internal::cleanup_index_type<LastType>::type,
|
|
||||||
typename internal::cleanup_seq_incr<IncrType>::type>
|
|
||||||
(f,l,typename internal::cleanup_seq_incr<IncrType>::type(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace internal {
|
|
||||||
|
|
||||||
template<typename FirstType,typename LastType,typename IncrType>
|
|
||||||
struct get_compile_time_incr<legacy::ArithmeticSequenceProxyWithBounds<FirstType,LastType,IncrType> > {
|
|
||||||
enum { value = get_fixed_value<IncrType,DynamicIndex>::value };
|
|
||||||
};
|
|
||||||
|
|
||||||
// Convert a symbolic range into a usable one (i.e., remove last/end "keywords")
|
|
||||||
template<typename FirstType,typename LastType,typename IncrType,int XprSize>
|
|
||||||
struct IndexedViewCompatibleType<legacy::ArithmeticSequenceProxyWithBounds<FirstType,LastType,IncrType>,XprSize> {
|
|
||||||
typedef legacy::ArithmeticSequenceProxyWithBounds<Index,Index,IncrType> type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename FirstType,typename LastType,typename IncrType>
|
|
||||||
legacy::ArithmeticSequenceProxyWithBounds<Index,Index,IncrType>
|
|
||||||
makeIndexedViewCompatible(const legacy::ArithmeticSequenceProxyWithBounds<FirstType,LastType,IncrType>& ids, Index size,SpecializedType) {
|
|
||||||
return legacy::ArithmeticSequenceProxyWithBounds<Index,Index,IncrType>(
|
|
||||||
eval_expr_given_size(ids.firstObject(),size),eval_expr_given_size(ids.lastObject(),size),ids.incrObject());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|
||||||
#endif // EIGEN_ARITHMETIC_SEQUENCE_H
|
#endif // EIGEN_ARITHMETIC_SEQUENCE_H
|
||||||
|
@ -289,10 +289,6 @@ void check_indexed_view()
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check legacy code
|
|
||||||
VERIFY_IS_APPROX( A(legacy::seq(legacy::last,2,-2), legacy::seq(legacy::last-6,7)), A(seq(last,2,-2), seq(last-6,7)) );
|
|
||||||
VERIFY_IS_APPROX( A(seqN(legacy::last,2,-2), seqN(legacy::last-6,3)), A(seqN(last,2,-2), seqN(last-6,3)) );
|
|
||||||
|
|
||||||
// check mat(i,j) with weird types for i and j
|
// check mat(i,j) with weird types for i and j
|
||||||
{
|
{
|
||||||
VERIFY_IS_APPROX( A(B.RowsAtCompileTime-1, 1), A(3,1) );
|
VERIFY_IS_APPROX( A(B.RowsAtCompileTime-1, 1), A(3,1) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user