vnl_fortran_copy.hxx
Go to the documentation of this file.
1 // This is core/vnl/vnl_fortran_copy.hxx
2 #ifndef vnl_fortran_copy_hxx_
3 #define vnl_fortran_copy_hxx_
4 //:
5 // \file
6 // \author Andrew W. Fitzgibbon, Oxford RRG
7 // \date 29 Aug 96
8 //-----------------------------------------------------------------------------
9 
10 #include "vnl_fortran_copy.h"
11 
12 //: Generate a fortran column-storage matrix from the given matrix.
13 template <class T>
15 {
16  unsigned n = M.rows();
17  unsigned p = M.columns();
18 
19  data = vnl_c_vector<T>::allocate_T(sz = n*p);
20  T *d = data;
21  for (unsigned j = 0; j < p; ++j)
22  for (unsigned i = 0; i < n; ++i)
23  *d++ = M(i,j);
24 }
25 
26 //: Destructor
27 template <class T>
29 {
31 }
32 
33 //--------------------------------------------------------------------------------
34 
35 #undef VNL_FORTRAN_COPY_INSTANTIATE
36 #define VNL_FORTRAN_COPY_INSTANTIATE(T) \
37 template class VNL_EXPORT vnl_fortran_copy<T >
38 
39 #endif // vnl_fortran_copy_hxx_
static void deallocate(T **, const std::size_t n_when_allocated)
Convert row-stored matrix to column-stored.
static T * allocate_T(const std::size_t n)
An ordinary mathematical matrix.
Definition: vnl_adjugate.h:22
vnl_fortran_copy(vnl_matrix< T > const &M)
Generate a fortran column-storage matrix from the given matrix.
unsigned int rows() const
Return the number of rows.
Definition: vnl_matrix.h:179
~vnl_fortran_copy()
Destructor.
unsigned int columns() const
Return the number of columns.
Definition: vnl_matrix.h:187