21 for (
tint i = 0; i < nSize; ++i) {
22 rv[
CVM0+i] =
static_cast<treal>(pd[i*nIncr]);
24 return static_cast<tint>(floor(rv.
norm() + 0.5));
32 for (
tint i = 0; i < nSize; ++i) {
42 tint ret = 0, max = - (std::numeric_limits<tint>::max)(), val;
43 for (
tint i = 0; i < nSize; ++i) {
58 tint ret = 0, min = (std::numeric_limits<tint>::max)(), val;
59 for (
tint i = 0; i < nSize; ++i) {
74 return SNRM2 (&nSize, mpd, &nIncr);
81 return DNRM2 (&nSize, mpd, &nIncr);
85 CVM_API
float __norm<float, std::complex<float> >(
const std::complex<float>* mpd,
tint nSize,
tint nIncr)
88 return SCNRM2 (&nSize, mpd, &nIncr);
92 CVM_API
double __norm<double, std::complex<double> >(
const std::complex<double>* mpd,
tint nSize,
tint nIncr)
95 return DZNRM2 (&nSize, mpd, &nIncr);
102 return ISAMAX (&nSize, mpd, &nIncr) - (1 -
CVM0);
109 return IDAMAX (&nSize, mpd, &nIncr) - (1 -
CVM0);
116 return ISAMIN (&nSize, mpd, &nIncr) - (1 -
CVM0);
123 return IDAMIN (&nSize, mpd, &nIncr) - (1 -
CVM0);
127 CVM_API
tint __idamax<std::complex<float> >(
const std::complex<float>* mpd,
tint nSize,
tint nIncr)
130 return ICAMAX (&nSize, mpd, &nIncr) - (1 -
CVM0);
134 CVM_API
tint __idamax<std::complex<double> >(
const std::complex<double>* mpd,
tint nSize,
tint nIncr)
137 return IZAMAX (&nSize, mpd, &nIncr) - (1 -
CVM0);
141 CVM_API
tint __idamin<std::complex<float> >(
const std::complex<float>* mpd,
tint nSize,
tint nIncr)
144 return ICAMIN (&nSize, mpd, &nIncr) - (1 -
CVM0);
148 CVM_API
tint __idamin<std::complex<double> >(
const std::complex<double>* mpd,
tint nSize,
tint nIncr)
151 return IZAMIN (&nSize, mpd, &nIncr) - (1 -
CVM0);
157 static const float one(1.F);
160 SAXPY (&mnSize, &one, pv, &nIncr, mpd, &mnIncr);
166 static const double one(1.);
169 DAXPY (&mnSize, &one, pv, &nIncr, mpd, &mnIncr);
175 static const float mone(-1.F);
178 SAXPY (&mnSize, &mone, pv, &nIncr, mpd, &mnIncr);
184 static const double mone(-1.F);
187 DAXPY (&mnSize, &mone, pv, &nIncr, mpd, &mnIncr);
191 CVM_API
void __add<std::complex<float> >(std::complex<float>* mpd,
tint mnSize,
tint mnIncr,
const std::complex<float>* pv,
tint nIncr)
193 static const std::complex<float> one(1.F, 0.F);
196 CAXPY (&mnSize, &one, pv, &nIncr, mpd, &mnIncr);
200 CVM_API
void __add<std::complex<double> >(std::complex<double>* mpd,
tint mnSize,
tint mnIncr,
const std::complex<double>* pv,
tint nIncr)
202 static const std::complex<double> one(1., 0.);
205 ZAXPY (&mnSize, &one, pv, &nIncr, mpd, &mnIncr);
209 CVM_API
void __subtract<std::complex<float> >(std::complex<float>* mpd,
tint mnSize,
tint mnIncr,
const std::complex<float>* pv,
tint nIncr)
211 static const std::complex<float> mone(-1.F, 0.F);
214 CAXPY (&mnSize, &mone, pv, &nIncr, mpd, &mnIncr);
218 CVM_API
void __subtract<std::complex<double> >(std::complex<double>* mpd,
tint mnSize,
tint mnIncr,
const std::complex<double>* pv,
tint nIncr)
220 static const std::complex<double> mone(-1., 0.);
223 ZAXPY (&mnSize, &mone, pv, &nIncr, mpd, &mnIncr);
230 SSCAL (&mnSize, &dScal, mpd, &mnIncr);
237 DSCAL (&mnSize, &dScal, mpd, &mnIncr);
241 CVM_API
void __scal<float, std::complex<float> >(std::complex<float>* mpd,
tint mnSize,
tint mnIncr,
float dScal)
244 CSSCAL (&mnSize, &dScal, mpd, &mnIncr);
248 CVM_API
void __scal<double, std::complex<double> >(std::complex<double>* mpd,
tint mnSize,
tint mnIncr,
double dScal)
251 ZDSCAL (&mnSize, &dScal, mpd, &mnIncr);
256 CVM_API
void __scal<std::complex<float>, std::complex<float> >(std::complex<float>* mpd,
tint mnSize,
tint mnIncr, std::complex<float> cScal)
259 CSCAL (&mnSize, &cScal, mpd, &mnIncr);
263 CVM_API
void __scal<std::complex<
double>, std::complex<
double> >(std::complex<
double>* mpd,
tint mnSize,
tint mnIncr, std::complex<
double> cScal)
266 ZSCAL (&mnSize, &cScal, mpd, &mnIncr);
271 CVM_API
void __copy2<
float, std::complex<
float> > (std::complex<
float>* mpd,
tint mnSize,
tint mnIncr,
272 const
float* pRe, const
float* pIm,
tint nReIncr,
tint nImIncr)
274 const tint nIncr2 = mnIncr * 2;
275 float* pR = __get_real_p<float>(mpd);
276 float* pI = __get_imag_p<float>(mpd);
282 SCOPY (&mnSize, pRe, &nReIncr, pR, &nIncr2);
286 static const float zero(0.F);
288 SSCAL (&mnSize, &zero, pR, &nIncr2);
295 SCOPY (&mnSize, pIm, &nImIncr, pI, &nIncr2);
299 static const float zero(0.F);
301 SSCAL (&mnSize, &zero, pI, &nIncr2);
306 CVM_API
void __copy2<double, std::complex<double> > (std::complex<double>* mpd,
tint mnSize,
tint mnIncr,
307 const double* pRe,
const double* pIm,
tint nReIncr,
tint nImIncr)
309 const tint nIncr2 = mnIncr * 2;
310 double* pR = __get_real_p<double>(mpd);
311 double* pI = __get_imag_p<double>(mpd);
317 DCOPY (&mnSize, pRe, &nReIncr, pR, &nIncr2);
321 static const double zero(0.);
323 DSCAL (&mnSize, &zero, pR, &nIncr2);
330 DCOPY (&mnSize, pIm, &nImIncr, pI, &nIncr2);
334 static const double zero(0.);
336 DSCAL (&mnSize, &zero, pI, &nIncr2);
341 CVM_API
void __copy_real<float, std::complex<float> > (std::complex<float>* mpd,
tint mnSize,
tint mnIncr,
const float* pRe,
tint nReIncr)
343 float* pdr = __get_real_p<float>(mpd);
346 const tint nIncr2 = mnIncr * 2;
349 SCOPY (&mnSize, pRe, &nReIncr, pdr, &nIncr2);
354 CVM_API
void __copy_real<double, std::complex<double> > (std::complex<double>* mpd,
tint mnSize,
tint mnIncr,
const double* pRe,
tint nReIncr)
356 double* pdr = __get_real_p<double>(mpd);
359 const tint nIncr2 = mnIncr * 2;
362 DCOPY (&mnSize, pRe, &nReIncr, pdr, &nIncr2);
367 CVM_API
void __copy_imag<float, std::complex<float> > (std::complex<float>* mpd,
tint mnSize,
tint mnIncr,
const float* pIm,
tint nImIncr)
369 float* pdi = __get_imag_p<float>(mpd);
372 const tint nIncr2 = mnIncr * 2;
375 SCOPY (&mnSize, pIm, &nImIncr, pdi, &nIncr2);
380 CVM_API
void __copy_imag<double, std::complex<double> > (std::complex<double>* mpd,
tint mnSize,
tint mnIncr,
const double* pIm,
tint nImIncr)
382 double* pdi = __get_imag_p<double>(mpd);
385 const tint nIncr2 = mnIncr * 2;
388 DCOPY (&mnSize, pIm, &nImIncr, pdi, &nIncr2);
393 CVM_API
void __conj<std::complex<float> > (std::complex<float>* mpd,
tint mnSize,
tint mnIncr)
395 CLACGV (&mnSize, mpd, &mnIncr);
399 CVM_API
void __conj<std::complex<double> > (std::complex<double>* mpd,
tint mnSize,
tint mnIncr)
401 ZLACGV (&mnSize, mpd, &mnIncr);
407 const tint nSize = mnSize * mnIncr;
408 for (
tint i = 0; i < nSize; i += mnIncr)
417 const tint nSize = mnSize * mnIncr;
418 for (
tint i = 0; i < nSize; i += mnIncr)
425 CVM_API
void __randomize_real<std::complex<float>,
float> (std::complex<float>* mpd,
tint mnSize,
tint mnIncr,
426 float dFrom,
float dTo)
428 const tint nIncr = 2 * mnIncr;
429 const tint nSize = mnSize * nIncr;
430 float* pdr = __get_real_p<float>(mpd);
432 for (
tint i = 0; i < nSize; i += nIncr)
439 CVM_API
void __randomize_real<std::complex<double>,
double> (std::complex<double>* mpd,
tint mnSize,
tint mnIncr,
440 double dFrom,
double dTo)
442 const tint nIncr = 2 * mnIncr;
443 const tint nSize = mnSize * nIncr;
444 double* pdr = __get_real_p<double>(mpd);
446 for (
tint i = 0; i < nSize; i += nIncr)
453 CVM_API
void __randomize_imag<std::complex<float>,
float> (std::complex<float>* mpd,
tint mnSize,
tint mnIncr,
454 float dFrom,
float dTo)
456 const tint nIncr = 2 * mnIncr;
457 const tint nSize = mnSize * nIncr;
458 float* pdi = __get_imag_p<float>(mpd);
460 for (
tint i = 0; i < nSize; i += nIncr)
467 CVM_API
void __randomize_imag<std::complex<double>,
double> (std::complex<double>* mpd,
tint mnSize,
tint mnIncr,
468 double dFrom,
double dTo)
470 const tint nIncr = 2 * mnIncr;
471 const tint nSize = mnSize * nIncr;
472 double* pdi = __get_imag_p<double>(mpd);
474 for (
tint i = 0; i < nSize; i += nIncr)