length equality update

This commit is contained in:
madrocketsci committed 2025-07-20 17:05:55 -04:00
1 parent cad98f8211
commit 13d73c67eb
33 files changed
+78 -33

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
{
"folders": [
{
"path": "."
},
{
"path": "../amsmathutil25"
}
]
}
+1 -1
View File
@@ -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)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
@@ -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
@@ -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
);
@@ -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,
@@ -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,
@@ -18,6 +18,6 @@ namespace narray
};
};
#include <amscppnarray/amscppnarray_llbopsimpl.hpp>
#include <amscppnarray25/amscppnarray_llbopsimpl.hpp>
#endif
@@ -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,
@@ -24,6 +24,6 @@ void narray_testmath3();
}; //end namespaces
};
#include <amscppnarray/amscppnarray_mathimpl.hpp>
#include <amscppnarray25/amscppnarray_mathimpl.hpp>
#endif
@@ -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,
@@ -1,4 +1,4 @@
#include <amscppnarray/amscppnarray.hpp>
#include <amscppnarray25/amscppnarray25.hpp>
namespace ams
{
@@ -1,4 +1,4 @@
#include <amscppnarray/amscppnarray.hpp>
#include <amscppnarray25/amscppnarray25.hpp>
namespace ams
{
@@ -64,6 +64,7 @@ narray<float> linspacef(const float low, const float high, narray_size_t N)
threads.resize(nthreads);
for(J=0;J<nthreads;J++)
{
threads[J] = NULL;
threads[J] = new(std::nothrow) std::thread(
&narray_linspacef_tf,
&ret,
@@ -145,6 +146,7 @@ narray<double> linspace(const double low, const double high, narray_size_t N)
threads.resize(nthreads);
for(J=0;J<nthreads;J++)
{
threads[J] = NULL;
threads[J] = new(std::nothrow) std::thread(
&narray_linspace_tf,
&ret,
@@ -1,4 +1,4 @@
#include <amscppnarray/amscppnarray.hpp>
#include <amscppnarray25/amscppnarray25.hpp>
namespace ams
{
@@ -1,4 +1,4 @@
#include <amscppnarray/amscppnarray.hpp>
#include <amscppnarray25/amscppnarray25.hpp>
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<nthreads;J++)
{
threads[J] = NULL;
threads[J] = new(std::nothrow) std::thread(
&narray_rand_threadf1<T>,
out,
@@ -536,6 +537,7 @@ namespace rand
}
for(J=0;J<nthreads;J++)
{
threads[J] = NULL;
threads[J] = new(std::nothrow) std::thread(
&narray_rand_threadf2<T>,
out,
+1 -1
View File
@@ -1,4 +1,4 @@
#include <amscppnarray/amscppnarray.hpp>
#include <amscppnarray25/amscppnarray25.hpp>
int main(int argc, char* argv[])
{