Stride.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>
00005 //
00006 // Eigen is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 3 of the License, or (at your option) any later version.
00010 //
00011 // Alternatively, you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License as
00013 // published by the Free Software Foundation; either version 2 of
00014 // the License, or (at your option) any later version.
00015 //
00016 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00017 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00019 // GNU General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License and a copy of the GNU General Public License along with
00023 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00024 
00025 #ifndef EIGEN_STRIDE_H
00026 #define EIGEN_STRIDE_H
00027 
00056 template<int _OuterStrideAtCompileTime, int _InnerStrideAtCompileTime>
00057 class Stride
00058 {
00059   public:
00060     typedef DenseIndex Index;
00061     enum {
00062       InnerStrideAtCompileTime = _InnerStrideAtCompileTime,
00063       OuterStrideAtCompileTime = _OuterStrideAtCompileTime
00064     };
00065 
00067     Stride()
00068       : m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime)
00069     {
00070       eigen_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic);
00071     }
00072 
00074     Stride(Index outerStride, Index innerStride)
00075       : m_outer(outerStride), m_inner(innerStride)
00076     {
00077       eigen_assert(innerStride>=0 && outerStride>=0);
00078     }
00079 
00081     Stride(const Stride& other)
00082       : m_outer(other.outer()), m_inner(other.inner())
00083     {}
00084 
00086     inline Index outer() const { return m_outer.value(); }
00088     inline Index inner() const { return m_inner.value(); }
00089 
00090   protected:
00091     internal::variable_if_dynamic<Index, OuterStrideAtCompileTime> m_outer;
00092     internal::variable_if_dynamic<Index, InnerStrideAtCompileTime> m_inner;
00093 };
00094 
00097 template<int Value = Dynamic>
00098 class InnerStride : public Stride<0, Value>
00099 {
00100     typedef Stride<0, Value> Base;
00101   public:
00102     typedef DenseIndex Index;
00103     InnerStride() : Base() {}
00104     InnerStride(Index v) : Base(0, v) {}
00105 };
00106 
00109 template<int Value = Dynamic>
00110 class OuterStride : public Stride<Value, 0>
00111 {
00112     typedef Stride<Value, 0> Base;
00113   public:
00114     typedef DenseIndex Index;
00115     OuterStride() : Base() {}
00116     OuterStride(Index v) : Base(v,0) {}
00117 };
00118 
00119 #endif // EIGEN_STRIDE_H


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:33:00