CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
zgsmatrix-misc.hpp File Reference

Go to the source code of this file.

Functions

void swap (zgsmatrix &A, zgsmatrix &B)
 
_zgsmatrix _ (zgsmatrix &mat)
 

Function Documentation

void swap ( zgsmatrix A,
zgsmatrix B 
)
inline

swap two matrices

Definition at line 301 of file zgsmatrix-misc.hpp.

References zgsmatrix::cols, zgsmatrix::data, zgsmatrix::m, zgsmatrix::n, and zgsmatrix::rows.

Referenced by _().

302 {CPPL_VERBOSE_REPORT;
303  std::swap(A.n,B.n);
304  std::swap(A.m,B.m);
305  std::swap(A.data,B.data);
306  std::swap(A.rows,B.rows);
307  std::swap(A.cols,B.cols);
308 }
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: zgsmatrix.hpp:12
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
void swap(zgsmatrix &A, zgsmatrix &B)
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: zgsmatrix.hpp:13
CPPL_INT m
matrix row size
Definition: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
_zgsmatrix _ ( zgsmatrix mat)
inline

convert user object to smart-temporary object

Definition at line 312 of file zgsmatrix-misc.hpp.

References _zgsmatrix::cols, zgsmatrix::cols, _zgsmatrix::data, zgsmatrix::data, zgsmatrix::m, _zgsmatrix::m, zgsmatrix::n, _zgsmatrix::n, _zgsmatrix::rows, zgsmatrix::rows, and swap().

313 {CPPL_VERBOSE_REPORT;
314  _zgsmatrix newmat;
315 
316  //////// shallow copy ////////
317  newmat.n =mat.n;
318  newmat.m =mat.m;
319  std::swap(newmat.data,mat.data);
320  std::swap(newmat.rows,mat.rows);
321  std::swap(newmat.cols,mat.cols);
322 
323  //////// nullify ////////
324  mat.m =0;
325  mat.n =0;
326 
327  return newmat;
328 }
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _zgsmatrix.hpp:12
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: _zgsmatrix.hpp:13
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
(DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class
Definition: _zgsmatrix.hpp:3
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: zgsmatrix.hpp:12
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
void swap(zgsmatrix &A, zgsmatrix &B)
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: zgsmatrix.hpp:13
CPPL_INT m
matrix row size
Definition: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11