vnl_fortran_copy.txx

来自「InsightToolkit-1.4.0(有大量的优化算法程序)」· TXX 代码 · 共 39 行

TXX
39
字号
// This is vxl/vnl/vnl_fortran_copy.txx
#ifndef vnl_fortran_copy_txx_
#define vnl_fortran_copy_txx_
//:
// \file
// \author Andrew W. Fitzgibbon, Oxford RRG
// \date   29 Aug 96
//-----------------------------------------------------------------------------

#include "vnl_fortran_copy.h"

//: Generate a fortran column-storage matrix from the given matrix.
template <class T>
vnl_fortran_copy<T>::vnl_fortran_copy(vnl_matrix<T> const & M)
{
  unsigned n = M.rows();
  unsigned p = M.columns();

  data = vnl_c_vector<T>::allocate_T(sz = n*p);
  T *d = data;
  for (unsigned j = 0; j < p; ++j)
    for (unsigned i = 0; i < n; ++i)
      *d++ = M(i,j);
}

//: Destructor
template <class T>
vnl_fortran_copy<T>::~vnl_fortran_copy()
{
  vnl_c_vector<T>::deallocate(data, sz);
}

//--------------------------------------------------------------------------------

#undef VNL_FORTRAN_COPY_INSTANTIATE
#define VNL_FORTRAN_COPY_INSTANTIATE(T) template class vnl_fortran_copy<T >

#endif // vnl_fortran_copy_txx_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?