SYNOPSIS
#include "matrix.h" BAND *bd_copy(BAND *in, BAND *out) IVEC *iv_copy(IVEC *in, IVEC *out) MAT *m_copy (MAT *in, MAT *out) MAT *_m_copy(MAT *in, MAT *out, int i0, int j0) PERM *px_copy(PERM *in, PERM *out) VEC *v_copy (VEC *in, VEC *out) VEC *_v_copy(VEC *in, VEC *out, int i0) MAT *m_move (MAT *in, int i0, int j0, int m0, int n0, MAT *out, int i1, int j1) VEC *v_move (VEC *in, int i0, int dim0, VEC *out, int i1) VEC *mv_move(MAT *in, int i0, int j0, int m0, int n0, VEC *out, int i1) MAT *vm_move(VEC *in, int i0, MAT *out, int i1, int j1, int m1, int n1)
#include "zmatrix.h" ZMAT *zm_copy(ZMAT *in, ZMAT *out) ZMAT *_zm_copy(ZMAT *in, ZMAT *out, int i0, int j0) ZVEC *zv_copy(ZVEC *in, ZVEC *out) ZVEC *_zv_copy(ZVEC *in, ZVEC *out) ZMAT *zm_move (ZMAT *in, int i0, int j0, int m0, int n0, ZMAT *out, int i1, int j1) ZVEC *zv_move (ZVEC *in, int i0, int dim0, ZVEC *out, int i1) ZVEC *zmv_move(ZMAT *in, int i0, int j0, int m0, int n0, ZVEC *out, int i1) ZMAT *zvm_move(ZVEC *in, int i0, ZMAT *out, int i1, int j1, int m1, int n1)
DESCRIPTION
All the routines bd_copy(), iv_copy(), m_copy(), px_copy(), v_copy(), zm_copy() and zv_copy() copy all of the data from one data structure to another, creating a new object if necessary (i.e.\ a NULL object is passed or out is not sufficiently big), by means of a call to bd_get(), iv_get(), m_get(), px_get() or v_get() etc.\ as appropriate. \newpage For m_copy(), v_copy(), bd_copy(), iv_copy(), zm_copy(), and \newlinezv_copy() if in is smaller than the object out, then it is copied into a region in out of the same size. If the sizes of the permutations differ in px_copy() then a new permutation is created and returned. The ``raw'' copy routines are _m_copy(in,out,i0,j0) and \newline_v_copy(in,out,i0). Here (i0,j0) is the position where the $(0,0)$ element of the in matrix is copied to; in is copied into a block of out. Similarly, for _v_copy(), i0 is the position of out where the zero element of in is copied to; in is copied to a block of components of out. The .._copy() routines all work in situ\/ with in == out, however, the\hfill\break _.._copy() routines will only work in situ\/ if i0 (and also j0 if this is also passed) is (are) zero. The complex routines zm_copy(in,out), zv_copy(in,out), and their ``raw'' versions _zm_copy(in,out,i0,j0) and _zv_copy(int,out,i0) operate entirely analogously to their real counterparts. The routines .._move() move blocks between matrices and vectors. A source block in a matrix is identified by the matrix structure (in), the co-ordinates ((i0,j0)) of the top left corner of the block and the number of rows (m0) and columns (n0) of the block. The target block of a matrix is identified by out and the co-ordinates of the top left corner of the block ((i1,j1)), except in the case of moving a block from a vector to a matrix (vm_move()). In that case the number of rows and columns of the target need to be specified. The source block of a vector is identified by the source vector (in), the starting index of the block (i0) and the dimension of the block (dim0). The target block of a vector is identified by the target vector out and the starting index (i1). The routine m_move() moves blocks between matrices, v_move() moves blocks between vectors, mv_move() moves blocks from matrices to vectors (copying by rows), and vm_move() moves blocks from vectors to matrices (again copying by rows). The routine zm_move() moves blocks between complex matrices, zv_move() moves blocks between complex vectors, zmv_move() moves blocks from complex matrices to complex vectors (copying by rows), and zvm_move() moves blocks from complex vectors to complex matrices (again copying by rows).
EXAMPLE
/* copy x to y */ v_copy(x,y); /* create a new vector z = x */ z = v_copy(x,VNULL); /* copy A to the block in B with top-left corner (3,5) */ _m_copy(A,B,3,5); /* an equivalent operation with m_move() */ m_move(A,0,0,A->m,A->n, B,3,5); /* copy a matrix into a block in a vector ... */ mv_move(A,0,0,A->m,A->n, y,3); /* ... and restore the matrix */ vm_move(y,3,A->m*A->n, A,0,0,A->m,A->n); /* construct a block diagonal matrix C = diag(A,B) */ C = m_get(A->m+B->m,A->n+B->n); m_move(A,0,0,A->m,A->n, C,0, 0); m_move(B,0,0,B->m,B->n, C,A->m,A->n);
SEE ALSO: .._get() routines
SOURCE FILE: copy.h, ivecop.c, zcopy.c, bdfactor.c