]> Dogcows Code - chaz/yoink/blob - src/cml/matrix/matrix_functions.h
cd2c92ab1e9a694a1e853223c3e132593ce8f033
[chaz/yoink] / src / cml / matrix / matrix_functions.h
1 /* -*- C++ -*- ------------------------------------------------------------
2
3 Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/
4
5 The Configurable Math Library (CML) is distributed under the terms of the
6 Boost Software License, v1.0 (see cml/LICENSE for details).
7
8 *-----------------------------------------------------------------------*/
9 /** @file
10 * @brief
11 */
12
13 #ifndef matrix_functions_h
14 #define matrix_functions_h
15
16 namespace cml {
17
18 /** Set the given matrix to the identity matrix.
19 *
20 * This only makes sense for a square matrix, but no error will be
21 * signaled if the matrix is not square.
22 *
23 * @todo This should return a MatrixXpr to allow loop unrolling, as should
24 * the class method.
25 */
26 template<typename E, class AT, typename BO, typename L>
27 inline matrix<E,AT,BO,L>
28 identity(const matrix<E,AT,BO,L>& m)
29 {
30 typename matrix<E,AT,BO,L>::temporary_type result;
31
32 /* This is a no-op for fixed-size matrices: */
33 cml::et::detail::Resize(result, m.size());
34 result.identity();
35 return result;
36 }
37
38 } // namespace cml
39
40 #endif
41
42 // -------------------------------------------------------------------------
43 // vim:ft=cpp
This page took 0.031077 seconds and 3 git commands to generate.