From 8f5774695f0a74ffaba9ac892c1534d2f560d461 Mon Sep 17 00:00:00 2001 From: madrocketsci Date: Mon, 12 May 2025 16:59:21 -0400 Subject: [PATCH] yet more additions --- README.md | 8 +++++++- build_linux64/libamscppnarray.linux64.a | Bin 485766 -> 485766 bytes build_linux64/objstore/amscppnarray_math.o | Bin 100944 -> 100944 bytes build_linux64/tests | Bin 1661304 -> 1661304 bytes include/amscppnarray/amscppnarray.hpp | 2 ++ include/amscppnarray/amscppnarray_impl.hpp | 22 +++++++++++++++++++++ src/amscppnarray/amscppnarray_math.cpp | 2 +- src/main.cpp | 2 +- 8 files changed, 33 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1cd3206..eede82e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # amscppperm1 -Numeric array template class library. A numeric array, in addition to the usual array operations, is expected to have numeric data that can be added, subtracted, multiplied, etc. \ No newline at end of file +Numeric array template class library. A numeric array, in addition to the usual array operations, is expected to have numeric data that can be added, subtracted, multiplied, etc. + +This numeric array class implements random number generation, threaded vector operations, threaded math and statistics for fast operations on the arrays. + +The primary object is the template class narray + + ams::narray::narray \ No newline at end of file diff --git a/build_linux64/libamscppnarray.linux64.a b/build_linux64/libamscppnarray.linux64.a index 9a39670937de0fc7f42230a9c27188a47d43a832..c3c18989ba9c8aa2b88d01e1da6e0fa9a1c28fc6 100644 GIT binary patch delta 40 scmZp>EZcTjwxNY_3)Ai$EDR67vbOKv!34z2K+FQftlRhRU^~760D^%Ns{jB1 delta 40 scmZp>EZcTjwxNY_3)Ai$EGY~O4DI`OFaa?$5VHU=>-POS*p6=i0AEECGynhq diff --git a/build_linux64/objstore/amscppnarray_math.o b/build_linux64/objstore/amscppnarray_math.o index 4a9478774de57d8bdbfbb2377b979fac6d611446..e910f58557593221ac70660cc7faadad9995eeb9 100644 GIT binary patch delta 23 fcmcaGh3&!=whf`&EDR67vNlI@Z;#|={9XqDa~TOd delta 23 fcmcaGh3&!=whf`&EGY~O49$_;+atLdzt;f(V(16O diff --git a/build_linux64/tests b/build_linux64/tests index f1d1844c14e323658bf6f8421836f1a9225db259..c34c08dca0781b2169373618689b0addcbd60871 100644 GIT binary patch delta 193 zcmeydDfP#u)D0V$M3!y1FSxbQQ6|Tf+evZFm2;1ePMbKrK|x4l^9`nIRi19wKPM0K z%eOE9!RC04HZ~T9hhJHnU+T5L)MErr zFA(zqF+UIs0I?tt3vGX?C)}LKX8|;o!Ie*-jmeppEx)~Lf-n$^Y_FOis<)rfqJ5>m Q7!ZpCvBdV3{*vc80TSI#WB>pF diff --git a/include/amscppnarray/amscppnarray.hpp b/include/amscppnarray/amscppnarray.hpp index 735e378..fdf3911 100644 --- a/include/amscppnarray/amscppnarray.hpp +++ b/include/amscppnarray/amscppnarray.hpp @@ -53,6 +53,8 @@ template class narray narray& operator=(const std::initializer_list initlist); ~narray(); + template operator narray() const; //casting datatypes + int resize(const narray_size_t newlength); const narray_size_t size() const; diff --git a/include/amscppnarray/amscppnarray_impl.hpp b/include/amscppnarray/amscppnarray_impl.hpp index 53c37e4..0e330ab 100644 --- a/include/amscppnarray/amscppnarray_impl.hpp +++ b/include/amscppnarray/amscppnarray_impl.hpp @@ -225,6 +225,28 @@ template narray& narray::operator=(const std::initializer_list return *this; } +template template narray::operator narray() const +{ + //casting datatypes + narray ret; + int res; + + res = ret.resize(this->length); + if(res!=narray_success) + { + ret.resize(0); + return ret; + } + else + { + buffer_copycast(&(ret.data),data,length); + } + + return ret; +} + + + template narray::~narray() { //printf("debug: destructor called for %p\n",this); diff --git a/src/amscppnarray/amscppnarray_math.cpp b/src/amscppnarray/amscppnarray_math.cpp index 5e28bf0..3115af7 100644 --- a/src/amscppnarray/amscppnarray_math.cpp +++ b/src/amscppnarray/amscppnarray_math.cpp @@ -63,7 +63,7 @@ namespace narray printf("rseed: %d\n",(int)rand::dpr32_rseed); //< -- this is different than the line above - narray unif = ams::narray::rand::narray_rand(100); + narray unif = ams::narray::rand::narray_rand(10000*10000); printf("rseed: %d\n",(int)rand::get_rseed()); diff --git a/src/main.cpp b/src/main.cpp index b316a02..5d8bf2d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,7 +9,7 @@ int main(int argc, char* argv[]) // ams::narray::test_narray3(); // ams::narray::narray_testmath1(); ams::narray::narray_testmath2(); - ams::narray::narray_testmath3(); + //ams::narray::narray_testmath3(); return ret; } \ No newline at end of file