/*---------------------------------------------------------------------------*
 *                                   IT++			             *
 *---------------------------------------------------------------------------*
 * Copyright (c) 1995-2004 by Tony Ottosson, Thomas Eriksson, Pål Frenger,   *
 * Tobias Ringström, and Jonas Samuelsson.                                   *
 *                                                                           *
 * Permission to use, copy, modify, and distribute this software and its     *
 * documentation under the terms of the GNU General Public License is hereby *
 * granted. No representations are made about the suitability of this        *
 * software for any purpose. It is provided "as is" without expressed or     *
 * implied warranty. See the GNU General Public License for more details.    *
 *---------------------------------------------------------------------------*/

/*!
  \file
  \brief Implementation of functions on vectors and matrices.
  \author Tony Ottosson

  1.21

  2003/05/22 08:55:19
*/

#include "base/matfunc.h"

namespace itpp {


  // ---------------------- Instantiations -----------------------------------------


  //! Template instantiation of length
  template int length(const vec &v);
  //! Template instantiation of length
  template int length(const cvec &v);
  //! Template instantiation of length
  template int length(const svec &v);
  //! Template instantiation of length
  template int length(const ivec &v);
  //! Template instantiation of length
  template int length(const bvec &v);

  //! Template instantiation of sum
  template double sum(const vec &v);
  //! Template instantiation of sum
  template complex<double> sum(const cvec &v);
  //! Template instantiation of sum
  template short sum(const svec &v);
  //! Template instantiation of sum
  template int sum(const ivec &v);
  //! Template instantiation of sum
  template bin sum(const bvec &v);

  //! Template instantiation of sum_sqr
  template double sum_sqr(const vec &v);
  //! Template instantiation of sum_sqr
  template complex<double> sum_sqr(const cvec &v);
  //! Template instantiation of sum_sqr
  template short sum_sqr(const svec &v);
  //! Template instantiation of sum_sqr
  template int sum_sqr(const ivec &v);
  //! Template instantiation of sum_sqr
  template bin sum_sqr(const bvec &v);

  //! Template instantiation of cumsum
  template vec cumsum(const vec &v);
  //! Template instantiation of cumsum
  template cvec cumsum(const cvec &v);
  //! Template instantiation of cumsum
  template svec cumsum(const svec &v);
  //! Template instantiation of cumsum
  template ivec cumsum(const ivec &v);
  //! Template instantiation of cumsum
  template bvec cumsum(const bvec &v);

  //! Template instantiation of product
  template double prod(const vec &v);
  //! Template instantiation of product
  template complex<double> prod(const cvec &v);
  //! Template instantiation of product
  template short prod(const svec &v);
  //! Template instantiation of product
  template int prod(const ivec &v);
  //! Template instantiation of product
  template bin prod(const bvec &v);

  //! Template instantiation of cross
  template vec cross(const vec &v1, const vec &v2);
  //! Template instantiation of cross
  template ivec cross(const ivec &v1, const ivec &v2);
  //! Template instantiation of cross
  template svec cross(const svec &v1, const svec &v2);

  //! Template instantiation of reverse
  template vec reverse(const vec &in);
  //! Template instantiation of reverse
  template cvec reverse(const cvec &in);
  //! Template instantiation of reverse
  template svec reverse(const svec &in);
  //! Template instantiation of reverse
  template ivec reverse(const ivec &in);
  //! Template instantiation of reverse
  template bvec reverse(const bvec &in);

  //! Template instantiation of repeat
  template vec repeat(const vec &v, int norepeats);
  //! Template instantiation of repeat
  template cvec repeat(const cvec &v, int norepeats);
  //! Template instantiation of repeat
  template svec repeat(const svec &v, int norepeats);
  //! Template instantiation of repeat
  template ivec repeat(const ivec &v, int norepeats);
  //! Template instantiation of repeat
  template bvec repeat(const bvec &v, int norepeats);

  //! Template instantiation of apply_function
  template vec apply_function(float (*f)(float), const vec &data);
  //! Template instantiation of apply_function
  template vec apply_function(double (*f)(double), const vec &data);
  //! Template instantiation of apply_function
  template cvec apply_function(complex<double> (*f)(complex<double>), const cvec &data);
  //! Template instantiation of apply_function
  template svec apply_function(short (*f)(short), const svec &data);
  //! Template instantiation of apply_function
  template ivec apply_function(int (*f)(int), const ivec &data);
  //! Template instantiation of apply_function
  template bvec apply_function(bin (*f)(bin), const bvec &data);


  //! Template instantiation of zero_pad
  template ivec zero_pad(const ivec &v, int n);
  //! Template instantiation of zero_pad
  template vec zero_pad(const vec &v, int n);
  //! Template instantiation of zero_pad
  template cvec zero_pad(const cvec &v, int n);
  //! Template instantiation of zero_pad
  template bvec zero_pad(const bvec &v, int n);

  //! Template instantiation of zero_pad
  template ivec zero_pad(const ivec &v);
  //! Template instantiation of zero_pad
  template vec zero_pad(const vec &v);
  //! Template instantiation of zero_pad
  template cvec zero_pad(const cvec &v);
  //! Template instantiation of zero_pad
  template bvec zero_pad(const bvec &v);

  //! Template instantiation of zero_pad
  template mat  zero_pad(const mat &, int, int);
  //! Template instantiation of zero_pad
  template cmat zero_pad(const cmat &, int, int);
  //! Template instantiation of zero_pad
  template imat zero_pad(const imat &, int, int);
  //! Template instantiation of zero_pad
  template bmat zero_pad(const bmat &, int, int);

  //! Template instantiation of sum
  template vec sum(const mat &m, int dim);
  //! Template instantiation of sum
  template cvec sum(const cmat &m, int dim);
  //! Template instantiation of sum
  template svec sum(const smat &m, int dim);
  //! Template instantiation of sum
  template ivec sum(const imat &m, int dim);
  //! Template instantiation of sum
  template bvec sum(const bmat &m, int dim);

  //! Template instantiation of sum_sqr
  template vec sum_sqr(const mat & m, int dim);
  //! Template instantiation of sum_sqr
  template cvec sum_sqr(const cmat &m, int dim);
  //! Template instantiation of sum_sqr
  template svec sum_sqr(const smat &m, int dim);
  //! Template instantiation of sum_sqr
  template ivec sum_sqr(const imat &m, int dim);
  //! Template instantiation of sum_sqr
  template bvec sum_sqr(const bmat &m, int dim);

  //! Template instantiation of cumsum
  template mat cumsum(const mat &m, int dim);
  //! Template instantiation of cumsum
  template cmat cumsum(const cmat &m, int dim);
  //! Template instantiation of cumsum
  template smat cumsum(const smat &m, int dim);
  //! Template instantiation of cumsum
  template imat cumsum(const imat &m, int dim);
  //! Template instantiation of cumsum
  template bmat cumsum(const bmat &m, int dim);

  //! Template instantiation of product
  template vec prod(const mat &m, int dim);
  // Template instantiation of product
  template cvec prod(const cmat &v, int dim);
  //! Template instantiation of product
  template svec prod(const smat &m, int dim);
  //! Template instantiation of product
  template ivec prod(const imat &m, int dim);

  //! Template instantiation of diag
  template vec diag(const mat &in);
  //! Template instantiation of diag
  template cvec diag(const cmat &in);

  //! Template instantiation of diag
  template void diag(const vec &in, mat &m);
  //! Template instantiation of diag
  template void diag(const cvec &in, cmat &m);

  //! Template instantiation of diag
  template mat diag(const vec &v);
  //! Template instantiation of diag
  template cmat diag(const cvec &v);

  //! Template instantiation of bidiag
  template mat bidiag(const vec &, const vec &);
  //! Template instantiation of bidiag
  template cmat bidiag(const cvec &, const cvec &);

  //! Template instantiation of bidiag
  template void bidiag(const vec &, const vec &, mat &);
  //! Template instantiation of bidiag
  template void bidiag(const cvec &, const cvec &, cmat &);

  //! Template instantiation of bidiag
  template void bidiag(const mat &, vec &, vec &);
  //! Template instantiation of bidiag
  template void bidiag(const cmat &, cvec &, cvec &);

  //! Template instantiation of tridiag
  template mat tridiag(const vec &main, const vec &, const vec &);
  //! Template instantiation of tridiag
  template cmat tridiag(const cvec &main, const cvec &, const cvec &);

  //! Template instantiation of tridiag
  template void tridiag(const vec &main, const vec &, const vec &, mat &);
  //! Template instantiation of tridiag
  template void tridiag(const cvec &main, const cvec &, const cvec &, cmat &);

  //! Template instantiation of tridiag
  template void tridiag(const mat &m, vec &, vec &, vec &);
  //! Template instantiation of tridiag
  template void tridiag(const cmat &m, cvec &, cvec &, cvec &);

  //! Template instantiation of trace
  template double trace(const mat &in);
  //! Template instantiation of trace
  template complex<double> trace(const cmat &in);
  //! Template instantiation of trace
  template short trace(const smat &in);
  //! Template instantiation of trace
  template int trace(const imat &in);
  //! Template instantiation of trace
  template bin trace(const bmat &in);

  //! Template instantiation of transpose
  template void transpose(const mat &m, mat &out);
  //! Template instantiation of transpose
  template void transpose(const cmat &m, cmat &out);
  //! Template instantiation of transpose
  template void transpose(const smat &m, smat &out);
  //! Template instantiation of transpose
  template void transpose(const imat &m, imat &out);
  //! Template instantiation of transpose
  template void transpose(const bmat &m, bmat &out);

  //! Template instantiation of transpose
  template mat transpose(const mat &m);
  //! Template instantiation of transpose
  template cmat transpose(const cmat &m);
  //! Template instantiation of transpose
  template smat transpose(const smat &m);
  //! Template instantiation of transpose
  template imat transpose(const imat &m);
  //! Template instantiation of transpose
  template bmat transpose(const bmat &m);


  //! Template instantiation of hermitian transpose
  template void hermitian_transpose(const mat &m, mat &out);
  //! Template instantiation of hermitian transpose
  template void hermitian_transpose(const cmat &m, cmat &out);
  //! Template instantiation of hermitian transpose
  template void hermitian_transpose(const smat &m, smat &out);
  //! Template instantiation of hermitian transpose
  template void hermitian_transpose(const imat &m, imat &out);
  //! Template instantiation of hermitian transpose
  template void hermitian_transpose(const bmat &m, bmat &out);

  //! Template instantiation of hermitian transpose
  template mat hermitian_transpose(const mat &m);
  //! Template instantiation of hermitian transpose
  template cmat hermitian_transpose(const cmat &m);
  //! Template instantiation of hermitian transpose
  template smat hermitian_transpose(const smat &m);
  //! Template instantiation of hermitian transpose
  template imat hermitian_transpose(const imat &m);
  //! Template instantiation of hermitian transpose
  template bmat hermitian_transpose(const bmat &m);

  //! Template instantiation of repeat
  template mat repeat(const mat &m, int norepeats);
  //! Template instantiation of repeat
  template cmat repeat(const cmat &m, int norepeats);
  //! Template instantiation of repeat
  template smat repeat(const smat &m, int norepeats);
  //! Template instantiation of repeat
  template imat repeat(const imat &m, int norepeats);
  //! Template instantiation of repeat
  template bmat repeat(const bmat &m, int norepeats);

  //! Template instantiation of apply_function
  template mat apply_function(float (*f)(float), const mat &data);
  //! Template instantiation of apply_function
  template mat apply_function(double (*f)(double), const mat &data);
  //! Template instantiation of apply_function
  template cmat apply_function(complex<double> (*f)(complex<double>), const cmat &data);
  //! Template instantiation of apply_function
  template smat apply_function(short (*f)(short), const smat &data);
  //! Template instantiation of apply_function
  template imat apply_function(int (*f)(int), const imat &data);
  //! Template instantiation of apply_function
  template bmat apply_function(bin (*f)(bin), const bmat &data);

  //! Template instantiation of rvectorize
  template  vec rvectorize(const  mat &m);
  //! Template instantiation of rvectorize
  template cvec rvectorize(const cmat &m);
  //! Template instantiation of rvectorize
  template  ivec rvectorize(const  imat &m);
  //! Template instantiation of rvectorize
  template  bvec rvectorize(const  bmat &m);

  //! Template instantiation of cvectorize
  template  vec cvectorize(const  mat &m);
  //! Template instantiation of cvectorize
  template cvec cvectorize(const cmat &m);
  //! Template instantiation of cvectorize
  template  ivec cvectorize(const  imat &m);
  //! Template instantiation of cvectorize
  template  bvec cvectorize(const  bmat &m);

  //! Template instantiation of reshape
  template  mat reshape(const  mat &m, int rows, int cols);
  //! Template instantiation of reshape
  template cmat reshape(const cmat &m, int rows, int cols);
  //! Template instantiation of reshape
  template  imat reshape(const  imat &m, int rows, int cols);
  //! Template instantiation of reshape
  template  bmat reshape(const  bmat &m, int rows, int cols);

  //! Template instantiation of reshape
  template  mat reshape(const  vec &m, int rows, int cols);
  //! Template instantiation of reshape
  template cmat reshape(const cvec &m, int rows, int cols);
  //! Template instantiation of reshape
  template  imat reshape(const  ivec &m, int rows, int cols);
  //! Template instantiation of reshape
  template  bmat reshape(const  bvec &m, int rows, int cols);

  //! Template instantiation of upsample
  template vec upsample(const vec &v, int usf);
  //! Template instantiation of upsample
  template cvec upsample(const cvec &v, int usf);
  //! Template instantiation of upsample
  template svec upsample(const svec &v, int usf);
  //! Template instantiation of upsample
  template ivec upsample(const ivec &v, int usf);
  //! Template instantiation of upsample
  template bvec upsample(const bvec &v, int usf);

  //! Template instantiation of upsample
  template mat upsample(const mat &v, int usf);
  //! Template instantiation of upsample
  template cmat upsample(const cmat &v, int usf);
  //! Template instantiation of upsample
  template smat upsample(const smat &v, int usf);
  //! Template instantiation of upsample
  template imat upsample(const imat &v, int usf);
  //! Template instantiation of upsample
  template bmat upsample(const bmat &v, int usf);

  //! Template instantiation of upsample
  template void upsample(const vec &v, int usf,  vec & u);
  //! Template instantiation of upsample
  template void upsample(const cvec &v, int usf,  cvec & u);
  //! Template instantiation of upsample
  template void upsample(const svec &v, int usf,  svec & u);
  //! Template instantiation of upsample
  template void upsample(const ivec &v, int usf,  ivec & u);
  //! Template instantiation of upsample
  template void upsample(const bvec &v, int usf,  bvec & u);

  //! Template instantiation of upsample
  template void upsample(const mat &v, int usf,  mat & u);
  //! Template instantiation of upsample
  template void upsample(const cmat &v, int usf,  cmat & u);
  //! Template instantiation of upsample
  template void upsample(const smat &v, int usf,  smat & u);
  //! Template instantiation of upsample
  template void upsample(const imat &v, int usf,  imat & u);
  //! Template instantiation of upsample
  template void upsample(const bmat &v, int usf,  bmat & u);

  //! Template instantiation of liniterp
  template vec lininterp(const vec &v, int usf);
  //! Template instantiation of liniterp
  template cvec lininterp(const cvec &v, int usf);

  //! Template instantiation of liniterp
  template mat lininterp(const mat &v, int usf);
  //! Template instantiation of liniterp
  template cmat lininterp(const cmat &v, int usf);

  //! Template instantiation of liniterp
  template void lininterp(const vec &v, int usf,  vec & u);
  //! Template instantiation of liniterp
  template void lininterp(const cvec &v, int usf,  cvec & u);

  //! Template instantiation of liniterp
  template void lininterp(const mat &v, int usf,  mat & u);
  //! Template instantiation of liniterp
  template void lininterp(const cmat &v, int usf,  cmat & u);

} //namespace itpp


syntax highlighted by Code2HTML, v. 0.9.1