diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-11-25 15:01:46 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-11-25 15:01:46 -0500 |
commit | 6ab7b34b64a7750780141be9bde302fcf9e0ee38 (patch) | |
tree | 28da48a9eed9f2b6faabd7f0c00b39ed86ccfd68 | |
parent | 17a851a74ca26f78ff15b54f318031784ae8969a (diff) | |
download | vecmathlib-6ab7b34b64a7750780141be9bde302fcf9e0ee38.zip vecmathlib-6ab7b34b64a7750780141be9bde302fcf9e0ee38.tar.gz |
Rename “automatic” vector types from float/double to float32/float64 for clarity
-rw-r--r-- | example.cc | 14 | ||||
-rw-r--r-- | example_float.cc | 16 | ||||
-rw-r--r-- | interp.cc | 2 | ||||
-rw-r--r-- | vecmathlib.h | 24 |
4 files changed, 28 insertions, 28 deletions
@@ -13,22 +13,22 @@ int main(int argc, char** argv) { // Declare a double precision vector with an architecture-dependent // number of elements - double_vec x; + float64_vec x; // Set each element separately. This is inefficient and should be // avoided if possible, but we want to demonstrate it here anyway. - for (int i=0; i<double_vec::size; ++i) x.set_elt(i, double(i)); - double_vec y = x + double_vec(1.0); + for (int i=0; i<float64_vec::size; ++i) x.set_elt(i, double(i)); + float64_vec y = x + float64_vec(1.0); y = sqrt(y); - double_vec z = log(y); + float64_vec z = log(y); // Boolean vectors are closely related to either double or float // vectors, thus we need to make a distinction - bool_double_vec b = x < y; + bool64_vec b = x < y; // Integer vectors are closely related to either double or float, // thus we need to make a distinction -- there is "long_vec" - // corresponding to "double_vec", and there is "int_vec" + // corresponding to "float64_vec", and there is "int_vec" // correpsonding to "float_vec". - long_vec i = convert_int(y); + int64_vec i = convert_int(y); cout << "x=" << x << "\n"; cout << "y=" << y << "\n"; diff --git a/example_float.cc b/example_float.cc index 6cdf1a6..fed91c7 100644 --- a/example_float.cc +++ b/example_float.cc @@ -13,22 +13,22 @@ int main(int argc, char** argv) { // Declare a float precision vector with an architecture-dependent // number of elements - float_vec x; + float32_vec x; // Set each element separately. This is inefficient and should be // avoided if possible, but we want to demonstrate it here anyway. - for (int i=0; i<float_vec::size; ++i) x.set_elt(i, float(i)); - float_vec y = x + float_vec(1.0); + for (int i=0; i<float32_vec::size; ++i) x.set_elt(i, float(i)); + float32_vec y = x + float32_vec(1.0); y = sqrt(y); - float_vec z = log(y); + float32_vec z = log(y); // Boolean vectors are closely related to either float or float // vectors, thus we need to make a distinction - bool_float_vec b = x < y; + bool32_vec b = x < y; // Integer vectors are closely related to either float or float, // thus we need to make a distinction -- there is "int_vec" - // corresponding to "float_vec", and there is "int_vec" - // correpsonding to "float_vec". - int_vec i = convert_int(y); + // corresponding to "float32_vec", and there is "int_vec" + // correpsonding to "float32_vec". + int32_vec i = convert_int(y); cout << "x=" << x << "\n"; cout << "y=" << y << "\n"; @@ -8,7 +8,7 @@ using namespace std; #include "vecmathlib.h" using namespace vecmathlib; -typedef double_vec realvec_t; +typedef float64_vec realvec_t; typedef realvec_t::real_t real_t; typedef realvec_t::intvec_t intvec_t; typedef intvec_t::int_t int_t; diff --git a/vecmathlib.h b/vecmathlib.h index 7956f73..9accd24 100644 --- a/vecmathlib.h +++ b/vecmathlib.h @@ -219,23 +219,23 @@ namespace vecmathlib { #endif #ifdef VECMATHLIB_MAX_FLOAT_VECSIZE - typedef realvec<float,VECMATHLIB_MAX_FLOAT_VECSIZE> float_vec; - typedef intvec<float,VECMATHLIB_MAX_FLOAT_VECSIZE> int_vec; - typedef boolvec<float,VECMATHLIB_MAX_FLOAT_VECSIZE> bool_float_vec; + typedef realvec<float,VECMATHLIB_MAX_FLOAT_VECSIZE> float32_vec; + typedef intvec<float,VECMATHLIB_MAX_FLOAT_VECSIZE> int32_vec; + typedef boolvec<float,VECMATHLIB_MAX_FLOAT_VECSIZE> bool32_vec; #else - typedef realpseudovec<float,1> float_vec; - typedef intpseudovec<float,1> int_vec; - typedef boolpseudovec<float,1> bool_float_vec; + typedef realpseudovec<float,1> float32_vec; + typedef intpseudovec<float,1> int32_vec; + typedef boolpseudovec<float,1> bool32_vec; #endif #ifdef VECMATHLIB_MAX_DOUBLE_VECSIZE - typedef realvec<double,VECMATHLIB_MAX_DOUBLE_VECSIZE> double_vec; - typedef intvec<double,VECMATHLIB_MAX_DOUBLE_VECSIZE> long_vec; - typedef boolvec<double,VECMATHLIB_MAX_DOUBLE_VECSIZE> bool_double_vec; + typedef realvec<double,VECMATHLIB_MAX_DOUBLE_VECSIZE> float64_vec; + typedef intvec<double,VECMATHLIB_MAX_DOUBLE_VECSIZE> int64_vec; + typedef boolvec<double,VECMATHLIB_MAX_DOUBLE_VECSIZE> bool64_vec; #else - typedef realpseudovec<double,1> double_vec; - typedef intpseudovec<double,1> long_vec; - typedef boolpseudovec<double,1> bool_double_vec; + typedef realpseudovec<double,1> float64_vec; + typedef intpseudovec<double,1> int64_vec; + typedef boolpseudovec<double,1> bool64_vec; #endif } |