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 9a39670..c3c1898 100644 Binary files a/build_linux64/libamscppnarray.linux64.a and b/build_linux64/libamscppnarray.linux64.a differ diff --git a/build_linux64/objstore/amscppnarray_math.o b/build_linux64/objstore/amscppnarray_math.o index 4a94787..e910f58 100644 Binary files a/build_linux64/objstore/amscppnarray_math.o and b/build_linux64/objstore/amscppnarray_math.o differ diff --git a/build_linux64/tests b/build_linux64/tests index f1d1844..c34c08d 100644 Binary files a/build_linux64/tests and b/build_linux64/tests differ 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