16#include "tbci/bvector.h"
20#include "tbci/vec_kern_unr_pref.h"
27# if defined(__AVX__) && !defined(NO_AVX)
28# include "tbci/vec_kern_special2.h"
30# include "tbci/vec_kern_special.h"
35#if !defined(NO_GD) && !defined(AUTO_DECL)
36# include "tbci/vector_gd.h"
43template <
typename T>
class Vector;
44template <
typename T>
class TVector;
46template <
typename T>
class Matrix;
47template <
typename T>
class TMatrix;
59# pragma interface "vector.h"
90 { this->
dim = tv.dim; this->
vec = tv.vec; }
104 unsigned long size ()
const {
return this->
dim; }
120 {
Vector<T> tv(*
this);
return (tv == v); }
123 {
Vector<T> v(*
this);
return bv.operator == (v); }
189 typename tbci_traits<T>::const_refval_type
190 get (
const unsigned long i)
const {
return this->
vec[
i]; }
193 T&
setval (
const T& val,
const unsigned long i)
const {
return this->
vec[
i] = val; }
194 T&
set (
const T& val,
const unsigned long i)
const {
return this->
vec[
i] = val; }
219 static const char*
vec_info() {
return "TVector"; }
223#ifndef HAVE_PROMOTION_BUG
276#if !defined(SMP) || defined(NOSMP_VECVEC)
302 (
const T*)(tc->
t_par[1]));
310 (
const T*)(tc->
t_par[1]));
318 (
const T*)(tc->
t_par[1]));
382 *(
const T*)(tc->
t_par[1]));
390 *(
const T*)(tc->
t_par[1]));
398 *(
const T*)(tc->
t_par[1]));
406 *(
const T*)(tc->
t_par[1]));
414 *(
const T*)(tc->
t_par[1]));
422 *(
const T*)(tc->
t_par[1]));
430 *(
const T*)(tc->
t_par[1]));
441 *(
const T*)(tc->
t_par[3]));
450 *(
const T*)(tc->
t_par[3]));
468 *(
const T*)(tc->
t_par[3]));
477 *(
const T*)(tc->
t_par[3]));
495 *(
const T*)(tc->
t_par[2]));
504 *(
const T*)(tc->
t_par[2]));
513 *(
const T*)(tc->
t_par[2]));
575#if !defined(SMP) || defined(NOSMP_VECVEC)
576#define STD_SMP_TEMPLATE2V(oper, dm, a1, a2) \
577 do_##oper <T> (dm, a1, a2)
578#define STD_SMP_TEMPLATE2C(oper, dm, a1, a2) \
579 do_##oper <T> (dm, a1, a2)
580#define STD_SMP_TEMPLATE3VV(oper, dm, a1, a2, a3) \
581 do_##oper <T> (dm, a1, a2, a3)
582#define STD_SMP_TEMPLATE3VC(oper, dm, a1, a2, a3) \
583 do_##oper <T> (dm, a1, a2, a3)
584#define STD_SMP_TEMPLATE3CC(oper, dm, a1, a2, a3) \
585 do_##oper <T> (dm, a1, a2, a3)
586#define STD_SMP_TEMPLATE4V(oper, dm, a1, a2, a3, a4) \
587 do_##oper <T> (dm, a1, a2, a3, a4)
588#define STD_SMP_TEMPLATE4C(oper, dm, a1, a2, a3, a4) \
589 do_##oper <T> (dm, a1, a2, a3, a4)
590#define STD_SMP_TEMPLATE5(oper, dm, a1, a2, a3, a4, a5) \
591 do_##oper <T> (dm, a1, a2, a3, a4, a5)
595#define _SMP_TMPL2V(oper,st,en,a1,a2,a3,a4,a5) do_##oper <T> (en-st, a1+st, a2+st)
596#define _JOB_TMPL2V(oper,st,en,a1,a2,a3,a4,a5) job_##oper <T>, en-st, a1+st, a2+st
597#define _SMP_TMPL2C(oper,st,en,a1,a2,a3,a4,a5) do_##oper <T> (en-st, a1+st, a2)
598#define _JOB_TMPL2C(oper,st,en,a1,a2,a3,a4,a5) job_##oper <T>, en-st, a1+st, &a2
599#define _SMP_TMPL3VV(oper,st,en,a1,a2,a3,a4,a5) do_##oper <T> (en-st, a1+st, a2+st, a3+st)
600#define _JOB_TMPL3VV(oper,st,en,a1,a2,a3,a4,a5) job_##oper <T>, en-st, a1+st, a2+st, a3+st
601#define _SMP_TMPL3VC(oper,st,en,a1,a2,a3,a4,a5) do_##oper <T> (en-st, a1+st, a2+st, a3)
602#define _JOB_TMPL3VC(oper,st,en,a1,a2,a3,a4,a5) job_##oper <T>, en-st, a1+st, a2+st, &a3
603#define _SMP_TMPL3CC(oper,st,en,a1,a2,a3,a4,a5) do_##oper <T> (en-st, a1+st, a2, a3)
604#define _JOB_TMPL3CC(oper,st,en,a1,a2,a3,a4,a5) job_##oper <T>, en-st, a1+st, &a2, &a3
605#define _SMP_TMPL4V(oper,st,en,a1,a2,a3,a4,a5) do_##oper <T> (en-st, a1+st, a2+st, a3+st, a4)
606#define _JOB_TMPL4V(oper,st,en,a1,a2,a3,a4,a5) job_##oper <T>, en-st, a1+st, a2+st, a3+st, &a4
607#define _SMP_TMPL4C(oper,st,en,a1,a2,a3,a4,a5) do_##oper <T> (en-st, a1+st, a2+st, a3, a4)
608#define _JOB_TMPL4C(oper,st,en,a1,a2,a3,a4,a5) job_##oper <T>, en-st, a1+st, a2+st, &a3, &a4
609#define _SMP_TMPL5(oper,st,en,a1,a2,a3,a4,a5) do_##oper <T> (en-st, a1+st, a2+st, a3+st, a4, a5)
610#define _JOB_TMPL5(oper,st,en,a1,a2,a3,a4,a5) job_##oper <T>, en-st, a1+st, a2+st, a3+st, &a4, &a5
617#define STD_SMP_TEMPLATE(oper, dm, a1, a2, a3, a4, a5, SMP_TMPL, JOB_TMPL, p2, p3) \
619 const unsigned n_thr = threads_avail (dm / SMP_VECSLICE2); \
620 update_n_thr(n_thr); \
621 if (LIKELY(n_thr < 2)) { \
622 SMP_TMPL(oper, 0, dm, a1, a2, a3, a4, a5); \
624 PREFETCH_W_MANY(a1, 3); \
627 const unsigned long first = slice_offset(2, n_thr, dm, a1); \
628 unsigned long st, en = first; \
632 for (_t = 0; _t < n_thr-1; ++_t) { \
633 st = en; en = slice_offset(_t+2, n_thr, dm, a1); \
634 thread_start (_t, JOB_TMPL(oper, st, en, a1, a2, a3, a4, a5), (void*)0); \
637 SMP_TMPL(oper, 0UL, first, a1, a2, a3, a4, a5); \
640 for (_t = 0; _t < n_thr-1; ++_t) \
644#define STD_SMP_TEMPLATE2V(oper, dm, a1, a2) \
645 STD_SMP_TEMPLATE(oper, dm, a1, a2, NULL, NULL, NULL, _SMP_TMPL2V, _JOB_TMPL2V, PREFETCH_R_MANY(a2,2);,)
646#define STD_SMP_TEMPLATE2C(oper, dm, a1, a2) \
647 STD_SMP_TEMPLATE(oper, dm, a1, a2, NULL, NULL, NULL, _SMP_TMPL2C, _JOB_TMPL2C,,)
648#define STD_SMP_TEMPLATE3VV(oper, dm, a1, a2, a3) \
649 STD_SMP_TEMPLATE(oper, dm, a1, a2, a3, NULL, NULL, _SMP_TMPL3VV, _JOB_TMPL3VV, PREFETCH_R_MANY(a2,2);, PREFETCH_R_MANY(a3,2);)
650#define STD_SMP_TEMPLATE3VC(oper, dm, a1, a2, a3) \
651 STD_SMP_TEMPLATE(oper, dm, a1, a2, a3, NULL, NULL, _SMP_TMPL3VC, _JOB_TMPL3VC, PREFETCH_R_MANY(a2,2);,)
652#define STD_SMP_TEMPLATE3CC(oper, dm, a1, a2, a3) \
653 STD_SMP_TEMPLATE(oper, dm, a1, a2, a3, NULL, NULL, _SMP_TMPL3CC, _JOB_TMPL3CC,,)
654#define STD_SMP_TEMPLATE4V(oper, dm, a1, a2, a3, a4) \
655 STD_SMP_TEMPLATE(oper, dm, a1, a2, a3, a4, NULL, _SMP_TMPL4V, _JOB_TMPL4V, PREFETCH_R_MANY(a2,2);,)
656#define STD_SMP_TEMPLATE4C(oper, dm, a1, a2, a3, a4) \
657 STD_SMP_TEMPLATE(oper, dm, a1, a2, a3, a4, NULL, _SMP_TMPL4C, _JOB_TMPL4C, PREFETCH_R_MANY(a2,2);,)
658#define STD_SMP_TEMPLATE5(oper, dm, a1, a2, a3, a4, a5) \
659 STD_SMP_TEMPLATE(oper, dm, a1, a2, a3, a4, a5, _SMP_TMPL5, _JOB_TMPL5, PREFETCH_R_MANY(a2,2);, PREFETCH_R_MANY(a3,2);)
699 BCHK(this->
dim!=
a.dim,
VecErr,
"TV += V operator with diff. sizes",
a.dim, *
this);
707 BCHK(this->
dim!=
a.dim,
VecErr,
"TV -= V operator with diff. sizes",
a.dim, *
this);
716 BCHK(this->
dim!=
a.dim,
VecErr,
"TV += TSV operator with diff. sizes",
a.dim, *
this);
726 BCHK(this->
dim!=
a.dim,
VecErr,
"TV -= TSV operator with diff. sizes",
a.dim, *
this);
780 const unsigned long dim =
b.size();
781 T* vec = &
b.setval(0);
792 const unsigned long dim =
b.size();
793 T* vec = &
b.setval(0);
814 T dv =
a /
b.fabssqr();
846 this->vec[
i] = -this->vec[
i];
958 BCHK (i1 < i0,
VecErr, Slicing needs ordered arguments, i0, *
this);
959 BCHK (i0 >= this->
dim,
VecErr, Slice: arg1 out of range, i0, *
this);
960 BCHK (i1 > this->
dim,
VecErr, Slice: arg2 out of range, i1, *
this);
975 BCHK (wh >= this->
dim,
VecErr, Tried to change not-exitsting idx, wh, *
this);
1003template <typename T>
1010template <typename T>
1025template <
typename T>
1032 void clone (
const bool =
false,
const T* = 0)
const;
1034 void detach (
const T* = 0)
const;
1083 fac = (
T)1;
mut =
true;
return *
this; }
1108#ifdef TSV_OP_FRIENDS
1120 inline unsigned long size ()
const {
return dim; }
1134#ifdef TSVEC_NEED_DOT
1147#ifndef HAVE_GCC295_FRIEND_BUG
1171template <
typename T>
1178template <
typename T>
1185 vec =
const_cast<T*
> (vv);
1195template <typename T>
1197{
ts.getfacref() = f *
ts.getfac();
return ts; }
1199template <
typename T>
1220template <
typename T>
1240template <
typename T>
1267template <
typename T>
1271 ts.destroy ();
destroy ();
return false;
1281 ts.destroy ();
destroy ();
return false;
1289 ts.destroy ();
destroy ();
return false;
1297template <
typename T>
1308template <
typename T>
1319template <
typename T>
1334template <
typename T>
1350template <
typename T>
1369template <
typename T>
1389template <
typename T>
1403template <
typename T>
1419template <
typename T>
1434template <typename T>
1439template <
typename T>
1454template <typename T>
1458template <
typename T>
1461 for (
unsigned long i = 0;
i <
ts.dim; ++
i)
1462 os <<
ts.vec[
i]*
ts.fac <<
" ";
1463 ts.destroy ();
return os;
1467template <
typename T>
1471 BCHK (wh >=
dim,
VecErr, Tried to change not-exitsting idx, wh, tv);
1478template <typename T>
1480{
return ts.fabssqr (); }
1487template <typename T>
1489{
return ts.fabs(); }
1492template <typename T>
1525template <
typename T>
1545 {
ts.eval (this->vec); this->vec =
ts.vec; this->dim =
ts.dim; }
1549 Vector (
const vararg va, ... );
1555 #if defined(__GNUC__) && defined VEC_CPLX_CONSTR
1562 typename tbci_traits<T>::const_refval_type
1565 typename tbci_traits<T>::const_refval_type
1596#ifdef TBCI_NEW_BRACKET
1599 {
TBCICOPY(this->vec,ptr,
T,this->dim);
return *
this; }
1641 T min (
unsigned long& pos)
const;
1642 T max (
unsigned long& pos)
const;
1668#ifndef HAVE_PROMOTION_BUG
1680template <typename T>
1686template <
typename T>
1689 this->vec = (
T*)0; this->dim = (unsigned)va; this->
keep =
false;
1691 this->vec =
NEW (
T, this->dim);
1697#if !defined(__clang__) || !defined(CPLX)
1698 for (
unsigned long i=0;
i < this->dim; ++
i)
1699 this->vec[
i] = va_arg (vl,
T);
1701 throw VecErr(
"vararg not supported for cplx in clang");
1702#warning no vararg support with cplx numbers and clang
1708#if defined(__GNUC__) && defined VEC_CPLX_CONSTR
1709template <
typename T>
1712 for (
unsigned long i = 0;
i < this->dim; ++
i)
1717template <
typename T>
1723 if (
LIKELY(this->dim == 0)) {
1726 if (
LIKELY(tsv.fac == (
T)1)) {
1735 for (
REGISTER unsigned long i = 0;
i < this->dim; ++
i)
1745template <
typename T>
1748 for (
unsigned long i = 0;
i < this->dim; ++
i)
1753template <
typename T>
1756 for (
unsigned long i = 0;
i < this->dim; ++
i)
1762#if !defined(SMP) || defined(NOSMP_VECSCALAR)
1765template <
typename T>
1771 do_vec_dot_exact <T> (
a.dim,
a.vec,
b.vec, s);
1773 do_vec_dot_quick <T> (
a.dim,
a.vec,
b.vec, s);
1782template <
typename T>
1785 BCHK(this->dim !=
a.dim,
VecErr, Scalar product with diff.
size Vectors,
a.size(), 0);
1788 do_vec_mult_exact <T> (this->dim, this->vec,
a.vec, s);
1790 do_vec_mult_quick <T> (this->dim, this->vec,
a.vec, s);
1801template <typename T>
1804 if (
sizeof(
T) <= 16)
1808 do_vec_dot_exact (tc->
t_size, (
const T*)(tc->
t_par[0]),
1811 do_vec_dot_quick (tc->
t_size, (
const T*)(tc->
t_par[0]),
1816template <
typename T>
1820 T res =
T(0);
unsigned long sz =
a.size();
1823 update_n_thr(n_thr);
1826 do_vec_dot_exact<T> (sz,
a.vec,
b.vec,
res);
1828 do_vec_dot_quick<T> (sz,
a.vec,
b.vec,
res);
1834 const unsigned long first = slice_offset(1, n_thr, sz,
a.vec);
1835 unsigned long st, en = first;
1839 results =
new T[n_thr];
1842 for (
unsigned t = 0; t < n_thr-1; ++t) {
1843 st = en; en = slice_offset(t+2, n_thr, sz,
a.vec);
1845 a.vec+st,
b.vec+st, results+t, (
void*)0);
1849 do_vec_dot_exact<T> (first,
a.vec,
b.vec,
res);
1851 do_vec_dot_quick<T> (first,
a.vec,
b.vec,
res);
1855 for (
unsigned t = 0; t < n_thr-1; ++t) {
1867 comp += (tmp -
res) -
y;
1872 results[t]: *((
T*)(
threads[t].t_res_dummy)));
1888template <typename T>
1893 do_vec_mult_exact (tc->
t_size, (
const T*)(tc->
t_par[0]),
1896 do_vec_mult_quick (tc->
t_size, (
const T*)(tc->
t_par[0]),
1901template <
typename T>
1904 BCHK(this->dim !=
a.size(),
VecErr, Scalar product with diff.
size Vectors,
a.size(), 0);
1905 T res =
T(0);
unsigned long sz = this->dim;
1908 update_n_thr(n_thr);
1911 do_vec_mult_exact<T> (sz, this->vec,
a.vec,
res);
1913 do_vec_mult_quick<T> (sz, this->vec,
a.vec,
res);
1919 const unsigned long first = sz/n_thr - (sz/n_thr)%4;
1920 unsigned long st, en = first;
1922 T* results =
new T[n_thr];
1925 for (
unsigned t = 0; t < n_thr-1; ++t) {
1926 st = en; en = (t+2)*sz / n_thr;
1930 this->vec+st,
a.vec+st, results+t, (
void*)0);
1934 do_vec_dot_exact<T> (first, this->vec,
a.vec,
res);
1936 do_vec_dot_quick<T> (first, this->vec,
a.vec,
res);
1940 for (
unsigned t = 0; t < n_thr-1; ++t) {
1942 T tmp =
res + results[t];
1944 comp += (tmp -
res) - results[t];
1949 results[t]: *((
T*)(
threads[t].t_res_dummy)));
1970 const unsigned long dim = v1.
size();
1975 if (
LIKELY(v1(0) != v2(0)))
1983 const unsigned long dim = v1.
size();
1995template <typename T>
2002template <
typename T>
2008template <
typename T>
2014template <
typename T>
2017 const unsigned long dim =
vec.size();
2020 _par_fill_fn(
dim, &
vec.setval(0), fn, par);
2023template <
typename T>
2028 return (
T)((*
this *
a) / div);
2031template <
typename T>
2034 if (
LIKELY(this->dim == 0))
2037 for (
REGISTER unsigned long t = 1; t < this->dim; t++)
2043template <
typename T>
2046 if (
LIKELY(this->dim == 0))
2048 BCHK (pos >= this->dim,
VecErr, pos outside range, pos, 0);
2050 for (
REGISTER unsigned long t = pos+1; t < this->dim; t++)
2052 min = this->vec[t]; pos = t;
2057template <
typename T>
2060 if (
LIKELY(this->dim == 0))
2063 for (
REGISTER unsigned long t = 1; t < this->dim; t++)
2069template <
typename T>
2072 if (
LIKELY(this->dim == 0))
2074 BCHK (pos >= this->dim,
VecErr, pos outside range, pos, 0);
2076 for (
REGISTER unsigned long t = pos+1; t < this->dim; t++)
2078 max = this->vec[t]; pos = t;
2085template <typename T>
2095template <
typename T>
2098 T res = 0.0;
const unsigned long sz = this->dim;
2101 update_n_thr(n_thr);
2104 do_vec_sum_exact<T> (sz, this->vec,
res);
2106 do_vec_sum_quick<T> (sz, this->vec,
res);
2110 const unsigned long first = slice_offset(1, n_thr, sz, this->vec);
2111 unsigned long st, en = first;
2113 T* results =
new T[n_thr];
2115 for (
unsigned t = 0; t < n_thr-1; ++t) {
2116 st = en; en = slice_offset(t+2, n_thr, sz, this->vec);
2118 this->vec+st, results+t, (
void*)0);
2122 do_vec_sum_exact<T> (first, this->vec,
res);
2124 do_vec_sum_quick<T> (first, this->vec,
res);
2127 for (
unsigned t = 0; t < n_thr-1; ++t) {
2129 T tmp =
res + results[t];
2131 comp += (tmp -
res) - results[t];
2142template <
typename T>
2147 do_vec_sum_exact<T> (this->dim, this->vec,
sum);
2149 do_vec_sum_quick<T> (this->dim, this->vec,
sum);
2156 if (!this->dim)
return 0.0;
2158 for (
unsigned long i = 1;
i < this->dim; ++
i)
2168template <
typename T>
2178template <
typename T>
2190template <
typename T>
2200template <
typename T>
2212template <
typename T>
2227template <
typename T>
2243template <
typename T>
2252template <
typename T>
2262template <
typename T>
2268template <
typename T>
2278template <typename T>
2281 const unsigned long dim = v.
size();
2283 const T*
const vvec(&v.
getcref(0));
2284 T*
const tvvec(&tv.
setval(0));
2292template <typename T>
2295 const unsigned long dim = v.
size();
2297 const T*
const vvec(&v.
getcref(0));
2298 T*
const tvvec(&tv.
setval(0));
2307template <typename T>
2317template <
typename T>
2325template <
typename T>
2329 do_vec_neg_vec<T> (this->dim, tv.
vec, this->vec);
2334template <
typename T>
2337 BCHK (i1 < i0,
VecErr, Slicing needs ordered arguments, i0, *
this);
2338 BCHK (i0 >= this->dim,
VecErr, Slice: arg1 out of range, i0, *
this);
2339 BCHK (i1 > this->dim,
VecErr, Slice: arg2 out of range, i1, *
this);
2347template <
typename T>
2351 BCHK (wh >= this->dim,
VecErr, Tried to change not-exitsting idx, wh, tv);
2358#define COST_VECFABSSQR(d) (d*(COST_UNIT_LOAD+COST_MULT+COST_ADD+COST_LOOP))
2359#define COST_VECSCALAR(d) (d*(2*COST_UNIT_LOAD+COST_MULT+COST_ADD+COST_LOOP))
2364template <typename T>
2369#if !defined(SMP) || defined(NOSMP_VECFABS)
2371template <
typename T>
2376 do_vec_fabssqr_exact (this->dim, this->vec,
res);
2378 do_vec_fabssqr_quick (this->dim, this->vec,
res);
2388template <typename T>
2398template <
typename T>
2401 double res = 0.0;
unsigned long sz = this->dim;
2404 update_n_thr(n_thr);
2407 do_vec_fabssqr_exact<T> (sz, this->vec,
res);
2409 do_vec_fabssqr_quick<T> (sz, this->vec,
res);
2413 const unsigned long first = slice_offset(1, n_thr, sz, this->vec);
2414 unsigned long st, en = first;
2417 for (
unsigned t = 0; t < n_thr-1; ++t) {
2418 st = en; en = slice_offset(t+2, n_thr, sz, this->vec);
2420 this->vec+st, (
void*)0);
2424 do_vec_fabssqr_exact<T> (first, this->vec,
res);
2426 do_vec_fabssqr_quick<T> (first, this->vec,
res);
2429 for (
unsigned t = 0; t < n_thr-1; ++t) {
2431 double tmp =
res +
y;
2433 comp += (tmp -
res) -
y;
2448template <typename T>
2474#ifdef VEC_INT_DIV_SUPPORT
2482 double dv = (double)
a /
b.fabssqr ();
2484 for (
unsigned long i = 0;
i <
b.size (); ++
i)
2485 b.set((
int)(
b.get(
i) * dv),
i);
2493 for (
REGISTER unsigned long i = 0;
i < this->dim; ++
i)
2501 double dv = (double)
a /
b.fabssqr ();
2504 for (
unsigned long i = 0;
i <
b.size (); ++
i)
2505 r.set ((
int)(dv *
b.get(
i)),
i);
2514 for (
unsigned long i = 0;
i < this->dim; ++
i)
2515 r.vec[
i] = this->vec[
i] /
a;
2527 for (
REGISTER unsigned long i = 0;
i < this->dim; ++
i)
2538 double dv = (double)
a /
b.fabssqr ();
2540 for (
unsigned long i = 0;
i <
b.size (); ++
i)
2541 b.set((
unsigned)(
b.get(
i) * dv),
i);
2549 double dv = (double)
a /
b.fabssqr ();
2552 for (
unsigned long i = 0;
i <
b.size (); ++
i)
2553 r.set ((
unsigned)(dv *
b.get(
i)),
i);
2562 for (
unsigned long i = 0;
i < this->dim; ++
i)
2563 r.vec[
i] = this->vec[
i] /
a;
STD__ istream & operator>>(STD__ istream &istr, BdMatrix< T > &mat)
#define BCHK(cond, exc, txt, ind, rtval)
#define LIKELY(expr)
branch prediction note that we sometimes on purpose mark the unlikely possibility likely and vice ver...
#define TBCICOMP(n, o, t, s)
#define NAMESPACE_CSTD_END
#define PREFETCH_R(addr, loc)
In case gcc does not yet support __builtin_prefetch(), we have handcoded assembly with gcc for a few ...
#define TBCICOPY(n, o, t, s)
provides basic Vector functionality but arithmetic operators (+=, - , *, /...).
bool operator>=(const BVector< T > &bv) const
BVector< T > & operator=(const T &a)
bool contains(const T &, unsigned long *=0) const
BVector< T > & fill(const T &) HOT
BVector< T > & resize(const BVector< T > &)
Actually it's a resize and copy (some people would expect the assignment op to do this).
bool operator==(const BVector< T > &) const HOT
KG, 2001-06-29: Strange: If we don't inline this, we seems to get better performance in our solver be...
T & operator()(const unsigned long) HOT
bool operator<=(const BVector< T > &bv) const
The class BdMatrix is an implementation to store and do operations on sparse Matrices with a band str...
BdMatrix< T > & operator-=(const BdMatrix< T > &)
BdMatrix< T > & operator+=(const BdMatrix< T > &)
BdMatrix< T > & operator*=(const T &)
void destroy()
destroy object explicitly
C++ class for sparse matrices using compressed row storage.
unsigned int size() const
exception class: Use MatErr from matrix.h
Temporary Base Class (non referable!) (acc.
Temporary object for scaled matrices.
Matrix class with optimized Matrix-Vector multiplication for symmetrical Matrices.
void detach(const T *=0) const
bool operator==(const Vector< T > &) const
TSVector< T > & operator/=(const T &f)
TSVector(const TVector< T > &tv, const T &f=(T) 1)
TSVector< T > & operator=(const TSVector< T > &ts)
const TSVector< T > & operator/(const T &f) const
const T & getcref(const unsigned long i) const HOT
T get(const unsigned long i) const HOT
void clone(const bool=false, const T *=0) const
const TSVector< T > & eval(const T *vv=0) const
TSVector< T > & operator*=(const T &f)
static const char * vec_info()
TVector< T > sub_t_tsv(const T &) const
TV = T - TSV.
TVector< T > operator+(const Vector< T > &) const HOT
TV = TSV + V.
TVector< T > incr(const unsigned long, const T=(T) 1) const
friend NOINST void FRIEND_TBCI2__ do_mat_tsv_mult FGD(const unsigned start, const unsigned end, TVector< T > *res, const Matrix< T > *mat, const TSVector< T > *rsv)
T operator()(const unsigned long i) const
friend NOINST double FRIEND_TBCI__ fabssqr FGDT(const TSVector< T > &)
T *const & vecptr() const
TSVector(const Vector< T > &v, const T &f=(T) 1)
unsigned long size() const
TVector< T > add_t_tsv(const T &) const
Helper member fn to prevent friendship TV = T + TSV.
T operator[](const unsigned long i) const
T aligned_value_type TALIGN(MIN_ALIGN2)
TSVector(const unsigned long d)
bool operator!=(const Vector< T > &v) const
TSVector(const TSVector< T > &ts)
const TSVector< T > & operator-() const
const TSVector< T > & operator*(const T &f) const
Temporary Base Class Idiom: Class TVector is used for temporary variables.
TSVector< T > operator/(const T &)
friend TVector< T > conj FGD(const Vector< T > &)
tbci_traits< T >::const_refval_type get(const unsigned long i) const
friend TVector< T > imag FGD(const Vector< T > &)
TVector(const T &val, const unsigned long d)
const T & getcref(const unsigned long i) const
bool operator==(const TVector< T > &tv) const
TVector< T > & operator+=(const T &)
TV += a.
friend TVector< T > &real FGD(TVector< T > &)
TVector< T > & operator-=(const T &)
TV -= a.
unsigned long size() const
TVector< T > slice(const unsigned long, const unsigned long)
TVector(const BVector< T > &bv)
TSVector< T > operator*(const T &)
TVector< T > & operator/=(const T &)
TV /= a.
T & set(const T &val, const unsigned long i) const
TSVector< T > operator-()
bool operator!=(const TVector< T > &tv) const
T aligned_value_type TALIGN(MIN_ALIGN2)
TVector(const TSVector< T > &ts)
friend TVector< T > &imag FGD(TVector< T > &)
TVector< T > & incr(const unsigned long, const T=(T) 1)
friend NOINST void FRIEND_TBCI2__ do_mat_tsv_mult FGD(const unsigned start, const unsigned end, TVector< T > *res, const Matrix< T > *mat, const TSVector< T > *rsv)
static const char * vec_info()
friend TVector< T > &conj FGD(TVector< T > &)
T & setval(const T &val, const unsigned long i) const
TVector< T > & operator=(const T &a)
T operator[](const unsigned long i)
TVector< T > & operator*=(const T &)
TV *= a.
TVector(const unsigned long d=0)
friend NOINST void FRIEND_TBCI2__ do_mat_vec_mult FGD(const unsigned start, const unsigned end, TVector< T > *res, const Matrix< T > *mat, const Vector< T > *vec)
friend NOINST void FRIEND_TBCI2__ do_mat_vec_transmult FGD(const unsigned start, const unsigned end, TVector< T > *res, const Matrix< T > *mat, const Vector< T > *vec)
T & setval(const unsigned long i) const
TVector(const TVector< T > &tv) HOT
TVector(const BVector< U > &bv)
friend TVector< T > real FGD(const Vector< T > &)
TVector< T > & operator+(const Vector< T > &) HOT
TVector(const Vector< T > &v)
T operator()(const unsigned long i)
T aligned_value_type TALIGN(MIN_ALIGN2)
bool operator>(const Vector< T > &v) const
Vector(const BVector< T > &bv)
tbci_traits< T >::const_refval_type operator()(const unsigned long i) const
bool operator>=(const Vector< T > &v) const
static const char * vec_info()
TSVector< T > operator/(const T &) const
bool operator!=(const Vector< T > &v) const
Vector(const TSVector< T > &ts)
Vector(const TVector< T > &tv)
tbci_traits< T >::const_refval_type operator[](const unsigned long i) const
Vector< T > & operator=(const T &a)
bool operator==(const Vector< T > &v) const
TSVector< T > operator*(const T &) const
Vector(const T &val, const unsigned long d)
TVector< T > slice(unsigned long, unsigned long) const
Vector(const Vector< T > &v)
double fabssqr() const HOT
Vector< T > & fill(const T &v)
friend T dot FGD(const Vector< T > &, const Vector< T > &) HOT
TVector< T > operator-() const
TVector< T > incr(const unsigned long, const T=(T) 1) const
Vector(const unsigned long d=0)
bool contains(const T &v) const
Vector(const BVector< U > &bv)
bool operator<(const Vector< T > &v) const
bool operator<=(const Vector< T > &v) const
TVector< T > operator+(const Vector< T > &) const HOT
TV = V + V.
T imag(const TBCI__ cplx< T > &z)
double fabs(const TBCI__ cplx< T > &c)
cplx< T > dot(const cplx< T > &a, const cplx< T > &b)
double fabssqr(const cplx< T > &c)
NAMESPACE_END NAMESPACE_CPLX TBCI__ cplx< T > conj(const TBCI__ cplx< T > &c)
double norm(const TBCI__ cplx< T > &c)
NAMESPACE_END NAMESPACE_CSTD TBCI__ cplx< T > sqrt(const TBCI__ cplx< T > &z)
T sum(const FS_Vector< dims, T > &fv)
#define TBCIDELETE(t, v, sz)
void do_mat_tsv_mult(const unsigned start, const unsigned end, TVector< T > *res, const Matrix< T > *mat, const TSVector< T > *vec)
void do_mat_vec_mult(const unsigned start, const unsigned end, TVector< T > *res, const Matrix< T > *mat, const Vector< T > *vec)
void do_mat_vec_transmult(const unsigned start, const unsigned end, TVector< T > *res, const Matrix< T > *mat, const Vector< T > *vec)
const unsigned TMatrix< T > const Matrix< T > * a
const unsigned TMatrix< T > * res
void thread_wait(const int thr_no, struct job_output *out)
double thread_wait_result(const int thr_no)
void thread_start(const int thr_no, thr_job_t job, const unsigned long sz,...)
struct thr_struct * threads
void(* thr_job_t)(struct thr_ctrl *)
Before the double inclusion guard on purpose!
#define THREAD_MAX_RES_LN
unsigned int do_exactsum()
#define VEC_INT_DIV_SUPPORT
#define STD_SMP_TEMPLATE5(oper, dm, a1, a2, a3, a4, a5)
void job_vec_sum(struct thr_ctrl *tc)
void job_svc_svc_add(struct thr_ctrl *tc)
vec = s*vec + s*vec;
double fabssqr(const Vector< T > &v)
#define STD_SMP_TEMPLATE2V(oper, dm, a1, a2)
void job_vec_sub_vec(struct thr_ctrl *tc)
vec -= vec;
void job_vec_add_val(struct thr_ctrl *tc)
vec += val;
void par_fill(Vector< T > &vec, vec_fill_fn< T > fn, void *par)
void job_vec_div_val(struct thr_ctrl *tc)
vec /= val;
NAMESPACE_END NAMESPACE_CSTD double fabs(const TBCI__ Vector< T > &v)
void job_svc_val_sub(struct thr_ctrl *tc)
vec = s*vec - val;
void job_svc_val_add(struct thr_ctrl *tc)
vec = s*vec + val;
#define STD_SMP_TEMPLATE4V(oper, dm, a1, a2, a3, a4)
void job_vec_mult(struct thr_ctrl *tc)
void job_val_vec_mul(struct thr_ctrl *tc)
vec = val * vec;
void job_val_div_vec(struct thr_ctrl *tc)
vec = val/self;
void job_vec_add_svc(struct thr_ctrl *tc)
vec += s*vec;
void job_vec_sub_vec_inv(struct thr_ctrl *tc)
vec -= vec; vec = -vec;
bool par_comp(const Vector< T > &v1, TVector< T > v2)
void job_val_vec_add(struct thr_ctrl *tc)
vec = val + vec;
void job_vec_sub_val(struct thr_ctrl *tc)
vec -= val;
void job_svc_vec_add(struct thr_ctrl *tc)
vec = s*vec + vec;
void job_val_svc_add(struct thr_ctrl *tc)
vec = val + s*vec;
STD__ ostream & operator<<(STD__ ostream &os, const TVector< T > &tv)
void job_vec_sub_svc(struct thr_ctrl *tc)
vec -= s*vec;
void job_val_svc_div(struct thr_ctrl *tc)
vec = val / s*vec;
void job_vec_val_sub(struct thr_ctrl *tc)
vec = vec - val;
void job_vec_svc_add(struct thr_ctrl *tc)
vec = vec + s*vec;
void job_vec_add_vec(struct thr_ctrl *tc)
vec += vec;
void job_vec_sub_svc_inv(struct thr_ctrl *tc)
vec -= s*vec;
TVector< T > & imag(TVector< T > &tv)
T dot(const Vector< T > &a, const Vector< T > &b)
void job_val_svc_sub(struct thr_ctrl *tc)
vec = val + s*vec;
void job_vec_vec_sub(struct thr_ctrl *tc)
vec = vec - vec;
#define STD_SMP_TEMPLATE3VV(oper, dm, a1, a2, a3)
TVector< T > & real(TVector< T > &tv)
void job_val_vec_div(struct thr_ctrl *tc)
vec = val / vec;
void job_val_sub_vec(struct thr_ctrl *tc)
vec -= val; vec = -vec;
#define STD_SMP_TEMPLATE3VC(oper, dm, a1, a2, a3)
#define STD_SMP_TEMPLATE2C(oper, dm, a1, a2)
void job_vec_svc_sub(struct thr_ctrl *tc)
vec = vec - s*vec;
void job_vec_val_mul(struct thr_ctrl *tc)
vec = vec * val;
TVector< T > & conj(TVector< T > &tv)
void job_val_vec_sub(struct thr_ctrl *tc)
vec = val - vec;
void job_svc_vec_sub(struct thr_ctrl *tc)
vec = s*vec - vec;
void job_vec_val_add(struct thr_ctrl *tc)
vec = vec + val;
#define STD_SMP_TEMPLATE4C(oper, dm, a1, a2, a3, a4)
void job_vec_vec_add(struct thr_ctrl *tc)
vec = vec + vec;
void job_vec_dot(struct thr_ctrl *tc)
void job_val_add_vec(struct thr_ctrl *tc)
vec += val;
TSVector< T > operator/(const T &a, TVector< T > b)
void job_vec_fabssqr(struct thr_ctrl *tc)
void job_svc_svc_sub(struct thr_ctrl *tc)
vec = s*vec - s*vec;
void job_vec_mul_val(struct thr_ctrl *tc)
vec *= val;