21#ifndef _libint2_src_lib_libint_vector_h_
22#define _libint2_src_lib_libint_vector_h_
24#if defined(__cplusplus)
29#include <libint2/util/type_traits.h>
44 template <std::
size_t N,
typename T>
58 std::fill_n(&(d[0]), N, a);
65 std::copy(&a[0], &a[0]+N, &d[0]);
69 for(std::size_t i=0; i<N; ++i)
75 for(std::size_t i=0; i<N; ++i)
81 for(std::size_t i=0; i<N; ++i)
86 operator double()
const {
93 template <std::
size_t N,
typename T>
94 Vector<N,T>
operator*(T a, Vector<N,T> b) {
96 for(std::size_t i=0; i<N; ++i)
101 template <std::
size_t N,
typename T>
102 Vector<N,T>
operator*(Vector<N,T> a, T b) {
104 for(std::size_t i=0; i<N; ++i)
109 template <std::
size_t N,
typename T>
110 Vector<N,T>
operator*(
int a, Vector<N,T> b) {
115 for (std::size_t i = 0; i < N; ++i)
121 template <std::
size_t N,
typename T>
122 Vector<N,T>
operator*(Vector<N,T> a,
int b) {
127 for (std::size_t i = 0; i < N; ++i)
133 template <std::
size_t N,
typename T>
134 Vector<N,T>
operator*(Vector<N,T> a, Vector<N,T> b) {
136 for(std::size_t i=0; i<N; ++i)
137 c.d[i] = a.d[i] * b.d[i];
141 template <std::
size_t N,
typename T>
142 Vector<N,T> operator+(Vector<N,T> a, Vector<N,T> b) {
144 for(std::size_t i=0; i<N; ++i)
145 c.d[i] = a.d[i] + b.d[i];
149 template <std::
size_t N,
typename T>
150 Vector<N,T> operator-(Vector<N,T> a, Vector<N,T> b) {
152 for(std::size_t i=0; i<N; ++i)
153 c.d[i] = a.d[i] - b.d[i];
157 template <std::
size_t N,
typename T>
158 Vector<N,T> operator/(Vector<N,T> a, Vector<N,T> b) {
160 for(std::size_t i=0; i<N; ++i)
161 c.d[i] = a.d[i] / b.d[i];
172 template <std::
size_t N,
typename T>
174 static const bool value =
true;
177 template <std::
size_t N,
typename T>
179 typedef T value_type;
180 static const std::size_t extent = N;
185#include "vector_x86.h"
186#include "vector_ppc.h"
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:24
SafePtr< CTimeEntity< typename ProductType< T, U >::result > > operator*(const SafePtr< CTimeEntity< T > > &A, const SafePtr< CTimeEntity< U > > &B)
Creates product A*B.
Definition: entity.h:280
Definition: type_traits.h:29
Vector<N,T> is used by vectorized Libint library as fixed-length vectors amenable for SIMD-style para...
Definition: vector.h:45
Vector()
creates a vector of default-initialized values.
Definition: vector.h:52
Vector(T a)
Initializes all elements to the same value.
Definition: vector.h:57
Vector(T(&a)[N])
creates a vector of values initialized by an ordinary static-sized array
Definition: vector.h:64
Definition: type_traits.h:34