diff --git a/amsnarray25.code-workspace b/amsnarray25.code-workspace new file mode 100644 index 0000000..9993edd --- /dev/null +++ b/amsnarray25.code-workspace @@ -0,0 +1,10 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../amsmathutil25" + } + ] +} diff --git a/build/make.mingw64.test.py b/build/make.mingw64.test.py index 00d184f..6cd0b6f 100644 --- a/build/make.mingw64.test.py +++ b/build/make.mingw64.test.py @@ -14,7 +14,7 @@ depdir = "./dependencies/winx64" #local pre-compiled dependency libraries and th installdir = "../../winx64" #directory to install to when finished builddir = "./build_mingw64" -doinstall = False #copies the build_output to the install dir when finished +doinstall = True #copies the build_output to the install dir when finished cc = "x86_64-w64-mingw32-g++" #compiler cflags = "-fPIC -O3" libraries = "-l{} -lamsmathutil25.mingw64".format(libname) diff --git a/build_linux64/libamscppnarray25.linux64.a b/build_linux64/libamscppnarray25.linux64.a index e72b947..29b6c95 100644 Binary files a/build_linux64/libamscppnarray25.linux64.a and b/build_linux64/libamscppnarray25.linux64.a differ diff --git a/build_linux64/objstore/amscppnarray.o b/build_linux64/objstore/amscppnarray.o index 2e8b28c..164b8b0 100644 Binary files a/build_linux64/objstore/amscppnarray.o and b/build_linux64/objstore/amscppnarray.o differ diff --git a/build_linux64/objstore/amscppnarray_inits.o b/build_linux64/objstore/amscppnarray_inits.o index 6ce4664..575f73a 100644 Binary files a/build_linux64/objstore/amscppnarray_inits.o and b/build_linux64/objstore/amscppnarray_inits.o differ diff --git a/build_linux64/objstore/amscppnarray_math.o b/build_linux64/objstore/amscppnarray_math.o index e910f58..c0923dc 100644 Binary files a/build_linux64/objstore/amscppnarray_math.o and b/build_linux64/objstore/amscppnarray_math.o differ diff --git a/build_linux64/objstore/amscppnarray_random.o b/build_linux64/objstore/amscppnarray_random.o index edb3c06..800a4df 100644 Binary files a/build_linux64/objstore/amscppnarray_random.o and b/build_linux64/objstore/amscppnarray_random.o differ diff --git a/build_linux64/tests b/build_linux64/tests index c6bc9ac..7321a74 100644 Binary files a/build_linux64/tests and b/build_linux64/tests differ diff --git a/build_linux64/tmp_testrand.bin b/build_linux64/tmp_testrand.bin index 003adaf..3a9312a 100644 Binary files a/build_linux64/tmp_testrand.bin and b/build_linux64/tmp_testrand.bin differ diff --git a/build_mingw64/libamscppnarray25.mingw64.a b/build_mingw64/libamscppnarray25.mingw64.a index 63c4b28..1b7f48c 100644 Binary files a/build_mingw64/libamscppnarray25.mingw64.a and b/build_mingw64/libamscppnarray25.mingw64.a differ diff --git a/build_mingw64/objstore/amscppnarray.o b/build_mingw64/objstore/amscppnarray.o index 3d89e84..e1f6adf 100644 Binary files a/build_mingw64/objstore/amscppnarray.o and b/build_mingw64/objstore/amscppnarray.o differ diff --git a/build_mingw64/objstore/amscppnarray_inits.o b/build_mingw64/objstore/amscppnarray_inits.o index 0e38514..b4ce674 100644 Binary files a/build_mingw64/objstore/amscppnarray_inits.o and b/build_mingw64/objstore/amscppnarray_inits.o differ diff --git a/build_mingw64/objstore/amscppnarray_math.o b/build_mingw64/objstore/amscppnarray_math.o index 86b5a3d..2a8033c 100644 Binary files a/build_mingw64/objstore/amscppnarray_math.o and b/build_mingw64/objstore/amscppnarray_math.o differ diff --git a/build_mingw64/objstore/amscppnarray_random.o b/build_mingw64/objstore/amscppnarray_random.o index cd4e06c..4ee3681 100644 Binary files a/build_mingw64/objstore/amscppnarray_random.o and b/build_mingw64/objstore/amscppnarray_random.o differ diff --git a/build_mingw64/tests.exe b/build_mingw64/tests.exe index ca8415c..b4f6b8e 100644 Binary files a/build_mingw64/tests.exe and b/build_mingw64/tests.exe differ diff --git a/build_mingw64/tmp_testrand.bin b/build_mingw64/tmp_testrand.bin index 022303d..527ef29 100644 Binary files a/build_mingw64/tmp_testrand.bin and b/build_mingw64/tmp_testrand.bin differ diff --git a/include/amscppnarray/amscppnarray.hpp b/include/amscppnarray25/amscppnarray25.hpp similarity index 86% rename from include/amscppnarray/amscppnarray.hpp rename to include/amscppnarray25/amscppnarray25.hpp index 68d8801..b5e9879 100644 --- a/include/amscppnarray/amscppnarray.hpp +++ b/include/amscppnarray25/amscppnarray25.hpp @@ -1,5 +1,5 @@ -#ifndef __AMSCPPNARRAY_HPP__ -#define __AMSCPPNARRAY_HPP__ +#ifndef __AMSCPPNARRAY25_HPP__ +#define __AMSCPPNARRAY25_HPP__ #include #include @@ -155,16 +155,16 @@ void test_insertdelete1(); }; //end namespace narray }; //end namespace ams -#include +#include -#include -#include -#include -#include +#include +#include +#include +#include -#include -#include +#include +#include -#include +#include #endif \ No newline at end of file diff --git a/include/amscppnarray/amscppnarray_binrw.hpp b/include/amscppnarray25/amscppnarray_binrw.hpp similarity index 85% rename from include/amscppnarray/amscppnarray_binrw.hpp rename to include/amscppnarray25/amscppnarray_binrw.hpp index 7b5d2b5..332d6b7 100644 --- a/include/amscppnarray/amscppnarray_binrw.hpp +++ b/include/amscppnarray25/amscppnarray_binrw.hpp @@ -16,6 +16,6 @@ template int fread_ndarray(FILE *fp, narray *data, narray +#include #endif \ No newline at end of file diff --git a/include/amscppnarray/amscppnarray_binrwimpl.hpp b/include/amscppnarray25/amscppnarray_binrwimpl.hpp similarity index 100% rename from include/amscppnarray/amscppnarray_binrwimpl.hpp rename to include/amscppnarray25/amscppnarray_binrwimpl.hpp diff --git a/include/amscppnarray/amscppnarray_impl.hpp b/include/amscppnarray25/amscppnarray_impl.hpp similarity index 98% rename from include/amscppnarray/amscppnarray_impl.hpp rename to include/amscppnarray25/amscppnarray_impl.hpp index 4d1f3b8..2e63a4b 100644 --- a/include/amscppnarray/amscppnarray_impl.hpp +++ b/include/amscppnarray25/amscppnarray_impl.hpp @@ -23,6 +23,12 @@ template int narray::resize(const narray_size_t newlength) T *newdata = NULL; narray_size_t ml; + if(newlength == length) + { + ret = narray_success; + return ret; + } + if(newlength<=0) { if(data!=NULL) {delete[] data; data=NULL;} @@ -316,6 +322,7 @@ template void narray::setall(const T& val) threads.resize(nthreads); for(J=0;J,this,val,J,nthreads ); diff --git a/include/amscppnarray/amscppnarray_implinits.hpp b/include/amscppnarray25/amscppnarray_implinits.hpp similarity index 98% rename from include/amscppnarray/amscppnarray_implinits.hpp rename to include/amscppnarray25/amscppnarray_implinits.hpp index 1f20dd7..390d7c5 100644 --- a/include/amscppnarray/amscppnarray_implinits.hpp +++ b/include/amscppnarray25/amscppnarray_implinits.hpp @@ -60,6 +60,7 @@ template narray arange(const T low, const T high, const T incr) threads.resize(nthreads); for(J=0;J, &ret, diff --git a/include/amscppnarray/amscppnarray_imploper.hpp b/include/amscppnarray25/amscppnarray_imploper.hpp similarity index 98% rename from include/amscppnarray/amscppnarray_imploper.hpp rename to include/amscppnarray25/amscppnarray_imploper.hpp index d62eecf..caea8bf 100644 --- a/include/amscppnarray/amscppnarray_imploper.hpp +++ b/include/amscppnarray25/amscppnarray_imploper.hpp @@ -73,6 +73,7 @@ namespace narray cmp.resize(nthreads); for(J=0;J, @@ -164,6 +165,7 @@ namespace narray threads.resize(nthreads); for(J=0;J, @@ -237,6 +239,7 @@ namespace narray threads.resize(nthreads); for(J=0;J, this, @@ -309,6 +312,7 @@ namespace narray threads.resize(nthreads); for(J=0;J, this, @@ -381,6 +385,7 @@ namespace narray threads.resize(nthreads); for(J=0;J, this, @@ -447,6 +452,7 @@ namespace narray threads.resize(nthreads); for(J=0;J, this, @@ -513,6 +519,7 @@ namespace narray threads.resize(nthreads); for(J=0;J, this, @@ -579,6 +586,7 @@ namespace narray threads.resize(nthreads); for(J=0;J, this, @@ -645,6 +653,7 @@ namespace narray threads.resize(nthreads); for(J=0;J, this, @@ -711,6 +720,7 @@ namespace narray threads.resize(nthreads); for(J=0;J, &n, @@ -776,6 +786,7 @@ namespace narray threads.resize(nthreads); for(J=0;J, this, @@ -856,6 +867,7 @@ namespace narray minarr.setall(this->data[0]); for(J=0;J, this, @@ -943,6 +955,7 @@ namespace narray maxarr.setall(this->data[0]); for(J=0;J, this, diff --git a/include/amscppnarray/amscppnarray_implsubarray.hpp b/include/amscppnarray25/amscppnarray_implsubarray.hpp similarity index 100% rename from include/amscppnarray/amscppnarray_implsubarray.hpp rename to include/amscppnarray25/amscppnarray_implsubarray.hpp diff --git a/include/amscppnarray/amscppnarray_llbops.hpp b/include/amscppnarray25/amscppnarray_llbops.hpp similarity index 87% rename from include/amscppnarray/amscppnarray_llbops.hpp rename to include/amscppnarray25/amscppnarray_llbops.hpp index 92cca79..1cc160e 100644 --- a/include/amscppnarray/amscppnarray_llbops.hpp +++ b/include/amscppnarray25/amscppnarray_llbops.hpp @@ -18,6 +18,6 @@ namespace narray }; }; -#include +#include #endif \ No newline at end of file diff --git a/include/amscppnarray/amscppnarray_llbopsimpl.hpp b/include/amscppnarray25/amscppnarray_llbopsimpl.hpp similarity index 91% rename from include/amscppnarray/amscppnarray_llbopsimpl.hpp rename to include/amscppnarray25/amscppnarray_llbopsimpl.hpp index 125dc49..6b69afa 100644 --- a/include/amscppnarray/amscppnarray_llbopsimpl.hpp +++ b/include/amscppnarray25/amscppnarray_llbopsimpl.hpp @@ -13,7 +13,10 @@ template void buffer_copycast_tf( int threadnum, int nthreads ) { - int I0,I1,Is,I; + narray_size_t I0=0; + narray_size_t I1=0; + narray_size_t Is=0; + narray_size_t I=0; Is = N/nthreads; I0 = Is*threadnum; @@ -28,9 +31,9 @@ template void buffer_copycast_tf( template void buffer_copycast(T1 *bufferto, const T2 *bufferfrom, const narray_size_t N) { - narray_size_t I; - int J; - int nthreads; + narray_size_t I = 0; + int J = 0; + int nthreads = 0; std::vector threads; if(N<=0) return; @@ -45,12 +48,13 @@ template void buffer_copycast(T1 *bufferto, const T2 * else { //threaded operation - nthreads = std::thread::hardware_concurrency(); nthreads = (nthreads<1) ? 1 : nthreads; nthreads = (nthreads>narray_max_threads) ? narray_max_threads : nthreads; threads.resize(nthreads); + + for(J=0;J void buffer_set_tf( template void buffer_set(T *buffer, const T val, const narray_size_t ind1, const narray_size_t ind2) { - narray_size_t I; - int J; - int nthreads; + narray_size_t I = 0; + int J = 0; + int nthreads = 1; std::vector threads; narray_size_t N = ind2-ind1; if(N<=0) return; + if(buffer==NULL) return; if(N void buffer_set(T *buffer, const T val, const narray_size_t for(J=0;J, buffer, diff --git a/include/amscppnarray/amscppnarray_math.hpp b/include/amscppnarray25/amscppnarray_math.hpp similarity index 92% rename from include/amscppnarray/amscppnarray_math.hpp rename to include/amscppnarray25/amscppnarray_math.hpp index 816d213..2b7cfc9 100644 --- a/include/amscppnarray/amscppnarray_math.hpp +++ b/include/amscppnarray25/amscppnarray_math.hpp @@ -24,6 +24,6 @@ void narray_testmath3(); }; //end namespaces }; -#include +#include #endif \ No newline at end of file diff --git a/include/amscppnarray/amscppnarray_mathimpl.hpp b/include/amscppnarray25/amscppnarray_mathimpl.hpp similarity index 98% rename from include/amscppnarray/amscppnarray_mathimpl.hpp rename to include/amscppnarray25/amscppnarray_mathimpl.hpp index 74ecc96..4fe0b63 100644 --- a/include/amscppnarray/amscppnarray_mathimpl.hpp +++ b/include/amscppnarray25/amscppnarray_mathimpl.hpp @@ -68,6 +68,7 @@ namespace narray sums.setall(T()); for(J=0;J, &q, @@ -167,6 +168,7 @@ namespace narray sums.setall(T()); for(J=0;J, &q, @@ -264,6 +266,7 @@ namespace narray sums.setall(T()); for(J=0;J, &q, @@ -355,6 +358,7 @@ namespace narray threads.resize(nthreads); for(J=0;J, &q, diff --git a/include/amscppnarray/amscppnarray_random.hpp b/include/amscppnarray25/amscppnarray_random.hpp similarity index 100% rename from include/amscppnarray/amscppnarray_random.hpp rename to include/amscppnarray25/amscppnarray_random.hpp diff --git a/src/amscppnarray/amscppnarray.cpp b/src/amscppnarray25/amscppnarray.cpp similarity index 93% rename from src/amscppnarray/amscppnarray.cpp rename to src/amscppnarray25/amscppnarray.cpp index 70ee5b3..997c0a8 100644 --- a/src/amscppnarray/amscppnarray.cpp +++ b/src/amscppnarray25/amscppnarray.cpp @@ -1,4 +1,4 @@ -#include +#include namespace ams { diff --git a/src/amscppnarray/amscppnarray_inits.cpp b/src/amscppnarray25/amscppnarray_inits.cpp similarity index 97% rename from src/amscppnarray/amscppnarray_inits.cpp rename to src/amscppnarray25/amscppnarray_inits.cpp index a354afb..fc9bc2f 100644 --- a/src/amscppnarray/amscppnarray_inits.cpp +++ b/src/amscppnarray25/amscppnarray_inits.cpp @@ -1,4 +1,4 @@ -#include +#include namespace ams { @@ -64,6 +64,7 @@ narray linspacef(const float low, const float high, narray_size_t N) threads.resize(nthreads); for(J=0;J linspace(const double low, const double high, narray_size_t N) threads.resize(nthreads); for(J=0;J +#include namespace ams { diff --git a/src/amscppnarray/amscppnarray_random.cpp b/src/amscppnarray25/amscppnarray_random.cpp similarity index 96% rename from src/amscppnarray/amscppnarray_random.cpp rename to src/amscppnarray25/amscppnarray_random.cpp index dca9d32..6ceab30 100644 --- a/src/amscppnarray/amscppnarray_random.cpp +++ b/src/amscppnarray25/amscppnarray_random.cpp @@ -1,4 +1,4 @@ -#include +#include namespace ams { @@ -66,7 +66,7 @@ namespace rand return ret; } - vec2 dpr32_randuvec2(narray_rands_t *seed) + ::ams::vec2 dpr32_randuvec2(narray_rands_t *seed) { vec2 ret = vec2(0,0); double th = ams::narray::rand::dpr32_randd(seed)*2.0*pi; @@ -74,7 +74,7 @@ namespace rand return ret; } - vec3 dpr32_randuvec3(narray_rands_t *seed) + ams::vec3 dpr32_randuvec3(narray_rands_t *seed) { vec3 ret; double az,el; @@ -86,7 +86,7 @@ namespace rand return ret; } - vec4 dpr32_randuvec4(narray_rands_t *seed) + ams::vec4 dpr32_randuvec4(narray_rands_t *seed) { vec4 ret; double x,y,z,w; @@ -101,7 +101,7 @@ namespace rand return ret; } - vec2f dpr32_randuvec2f(narray_rands_t *seed) + ams::vec2f dpr32_randuvec2f(narray_rands_t *seed) { vec2f ret = vec2f(0,0); float th = ams::narray::rand::dpr32_randf(seed)*2.0*pi; @@ -109,7 +109,7 @@ namespace rand return ret; } - vec3f dpr32_randuvec3f(narray_rands_t *seed) + ams::vec3f dpr32_randuvec3f(narray_rands_t *seed) { vec3f ret; float az,el; @@ -121,7 +121,7 @@ namespace rand return ret; } - vec4f dpr32_randuvec4f(narray_rands_t *seed) + ams::vec4f dpr32_randuvec4f(narray_rands_t *seed) { vec4f ret; float x,y,z,w; @@ -217,6 +217,7 @@ namespace rand } for(J=0;J, out, @@ -536,6 +537,7 @@ namespace rand } for(J=0;J, out, diff --git a/src/main.cpp b/src/main.cpp index 0dc4ecc..0243d8a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,4 @@ -#include +#include int main(int argc, char* argv[]) {