]> Dogcows Code - chaz/yoink/blobdiff - src/cml/matrix/matrix_traits.h
now using cml for vectors and math stuff
[chaz/yoink] / src / cml / matrix / matrix_traits.h
diff --git a/src/cml/matrix/matrix_traits.h b/src/cml/matrix/matrix_traits.h
new file mode 100644 (file)
index 0000000..7574ff6
--- /dev/null
@@ -0,0 +1,49 @@
+/* -*- C++ -*- ------------------------------------------------------------
+Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/
+
+The Configurable Math Library (CML) is distributed under the terms of the
+Boost Software License, v1.0 (see cml/LICENSE for details).
+
+ *-----------------------------------------------------------------------*/
+/** @file
+ *  @brief
+ */
+
+#ifndef matrix_traits_h
+#define matrix_traits_h
+
+#include <cml/et/traits.h>
+
+namespace cml {
+namespace et {
+
+template<typename E, class AT, typename BO, typename L>
+struct ExprTraits< cml::matrix<E,AT,BO,L> >
+{
+    typedef typename cml::matrix<E,AT,BO,L> expr_type;
+    typedef typename expr_type::value_type value_type;
+    typedef typename expr_type::expr_reference reference;
+    typedef typename expr_type::expr_const_reference const_reference;
+    typedef typename expr_type::result_tag result_tag;
+    typedef typename expr_type::size_tag size_tag;
+    typedef typename expr_type::assignable_tag assignable_tag;
+    typedef expr_type result_type;
+    typedef expr_leaf_tag node_tag;
+
+    value_type get(const expr_type& m, size_t i, size_t j) const {
+        return m(i,j);
+    }
+
+    matrix_size size(const expr_type& e) const { return e.size(); }
+    size_t rows(const expr_type& m) const { return m.rows(); }
+    size_t cols(const expr_type& m) const { return m.cols(); }
+};
+
+} // namespace et
+} // namespace cml
+
+#endif
+
+// -------------------------------------------------------------------------
+// vim:ft=cpp
This page took 0.025413 seconds and 4 git commands to generate.