length equality update
This commit is contained in:
1 parent
cad98f8211
commit
13d73c67eb
33 files changed
+78
-33
No files matched your search
@@ -1,5 +1,5 @@
|
||||
#ifndef __AMSCPPNARRAY_HPP__
|
||||
#define __AMSCPPNARRAY_HPP__
|
||||
#ifndef __AMSCPPNARRAY25_HPP__
|
||||
#define __AMSCPPNARRAY25_HPP__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -155,16 +155,16 @@ void test_insertdelete1();
|
||||
}; //end namespace narray
|
||||
}; //end namespace ams
|
||||
|
||||
#include <amscppnarray/amscppnarray_llbops.hpp>
|
||||
#include <amscppnarray25/amscppnarray_llbops.hpp>
|
||||
|
||||
#include <amscppnarray/amscppnarray_impl.hpp>
|
||||
#include <amscppnarray/amscppnarray_imploper.hpp>
|
||||
#include <amscppnarray/amscppnarray_implsubarray.hpp>
|
||||
#include <amscppnarray/amscppnarray_implinits.hpp>
|
||||
#include <amscppnarray25/amscppnarray_impl.hpp>
|
||||
#include <amscppnarray25/amscppnarray_imploper.hpp>
|
||||
#include <amscppnarray25/amscppnarray_implsubarray.hpp>
|
||||
#include <amscppnarray25/amscppnarray_implinits.hpp>
|
||||
|
||||
#include <amscppnarray/amscppnarray_random.hpp>
|
||||
#include <amscppnarray/amscppnarray_math.hpp>
|
||||
#include <amscppnarray25/amscppnarray_random.hpp>
|
||||
#include <amscppnarray25/amscppnarray_math.hpp>
|
||||
|
||||
#include <amscppnarray/amscppnarray_binrw.hpp>
|
||||
#include <amscppnarray25/amscppnarray_binrw.hpp>
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -16,6 +16,6 @@ template<typename T> int fread_ndarray(FILE *fp, narray<T> *data, narray<int32_t
|
||||
};
|
||||
};
|
||||
|
||||
#include <amscppnarray/amscppnarray_binrwimpl.hpp>
|
||||
#include <amscppnarray25/amscppnarray_binrwimpl.hpp>
|
||||
|
||||
#endif
|
||||
File renamed without changes.
+7
@@ -23,6 +23,12 @@ template<typename T> int narray<T>::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<typename T> void narray<T>::setall(const T& val)
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_setall_tf<T>,this,val,J,nthreads
|
||||
);
|
||||
+1
@@ -60,6 +60,7 @@ template<typename T> narray<T> arange(const T low, const T high, const T incr)
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_arange_tf<T>,
|
||||
&ret,
|
||||
+13
@@ -73,6 +73,7 @@ namespace narray
|
||||
cmp.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
//printf("debug: launching thread %d\n",J);
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_operator_comp_tf<T>,
|
||||
@@ -164,6 +165,7 @@ namespace narray
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
//printf("debug: launching thread %d\n",J);
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_operator_add_tf<T>,
|
||||
@@ -237,6 +239,7 @@ namespace narray
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_operator_sub_tf<T>,
|
||||
this,
|
||||
@@ -309,6 +312,7 @@ namespace narray
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_operator_mult_tf<T>,
|
||||
this,
|
||||
@@ -381,6 +385,7 @@ namespace narray
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_operator_div_tf<T>,
|
||||
this,
|
||||
@@ -447,6 +452,7 @@ namespace narray
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_operator_add2_tf<T>,
|
||||
this,
|
||||
@@ -513,6 +519,7 @@ namespace narray
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_operator_sub2_tf<T>,
|
||||
this,
|
||||
@@ -579,6 +586,7 @@ namespace narray
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_operator_mult2_tf<T>,
|
||||
this,
|
||||
@@ -645,6 +653,7 @@ namespace narray
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_operator_div2_tf<T>,
|
||||
this,
|
||||
@@ -711,6 +720,7 @@ namespace narray
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_operator_negative_tf<T>,
|
||||
&n,
|
||||
@@ -776,6 +786,7 @@ namespace narray
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_applyfn_tf<T>,
|
||||
this,
|
||||
@@ -856,6 +867,7 @@ namespace narray
|
||||
minarr.setall(this->data[0]);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_min_tf<T>,
|
||||
this,
|
||||
@@ -943,6 +955,7 @@ namespace narray
|
||||
maxarr.setall(this->data[0]);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_max_tf<T>,
|
||||
this,
|
||||
File renamed without changes.
+1
-1
@@ -18,6 +18,6 @@ namespace narray
|
||||
};
|
||||
};
|
||||
|
||||
#include <amscppnarray/amscppnarray_llbopsimpl.hpp>
|
||||
#include <amscppnarray25/amscppnarray_llbopsimpl.hpp>
|
||||
|
||||
#endif
|
||||
+14
-8
@@ -13,7 +13,10 @@ template<typename T1, typename T2> 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<typename T1, typename T2> void buffer_copycast_tf(
|
||||
|
||||
template<typename T1, typename T2> 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<std::thread*> threads;
|
||||
|
||||
if(N<=0) return;
|
||||
@@ -45,12 +48,13 @@ template<typename T1, typename T2> 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<nthreads;J++) threads[J] = NULL;
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
@@ -107,13 +111,14 @@ template<typename T> void buffer_set_tf(
|
||||
|
||||
template<typename T> 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<std::thread*> threads;
|
||||
|
||||
narray_size_t N = ind2-ind1;
|
||||
if(N<=0) return;
|
||||
if(buffer==NULL) return;
|
||||
|
||||
if(N<narray_thread_sz)
|
||||
{
|
||||
@@ -133,6 +138,7 @@ template<typename T> void buffer_set(T *buffer, const T val, const narray_size_t
|
||||
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&buffer_set_tf<T>,
|
||||
buffer,
|
||||
+1
-1
@@ -24,6 +24,6 @@ void narray_testmath3();
|
||||
}; //end namespaces
|
||||
};
|
||||
|
||||
#include <amscppnarray/amscppnarray_mathimpl.hpp>
|
||||
#include <amscppnarray25/amscppnarray_mathimpl.hpp>
|
||||
|
||||
#endif
|
||||
+4
@@ -68,6 +68,7 @@ namespace narray
|
||||
sums.setall(T());
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_sum_tf<T>,
|
||||
&q,
|
||||
@@ -167,6 +168,7 @@ namespace narray
|
||||
sums.setall(T());
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_variance_tf<T>,
|
||||
&q,
|
||||
@@ -264,6 +266,7 @@ namespace narray
|
||||
sums.setall(T());
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_L2norm_tf<T>,
|
||||
&q,
|
||||
@@ -355,6 +358,7 @@ namespace narray
|
||||
threads.resize(nthreads);
|
||||
for(J=0;J<nthreads;J++)
|
||||
{
|
||||
threads[J] = NULL;
|
||||
threads[J] = new(std::nothrow) std::thread(
|
||||
&narray_abs_tf<T>,
|
||||
&q,
|
||||
File renamed without changes.
Reference in new issue
Block a user