Skip to content

Commit

Permalink
NNS 10.7 Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
OVVO-Financial authored Mar 4, 2024
1 parent 69b6503 commit 00b1f0e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
Binary file modified NNS_10.7.tar.gz
Binary file not shown.
Binary file modified NNS_10.7.zip
Binary file not shown.
Binary file modified src/NNS.dll
Binary file not shown.
Binary file modified src/RcppExports.o
Binary file not shown.
17 changes: 9 additions & 8 deletions src/partial_moments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ double CoUPM_C(
Rcpp::warning("x vector length != y vector length");
if (min_size<=0) // if len = 0, return 0
return 0;

double out=0;
bool d_upm_0=(degree_upm==0);
for(size_t i=0; i<min_size; i++){
Expand All @@ -152,7 +152,7 @@ double CoUPM_C(

x1 = (x1 < 0 ? 0 : x1);
y1 = (y1 < 0 ? 0 : y1);

if(isInteger(degree_upm)){
if(d_upm_0) out += x1 * y1;
else
Expand Down Expand Up @@ -260,29 +260,30 @@ double DUPM_C(
if (min_size<=0) // if len = 0, return 0
return 0;
double out=0;

bool dont_use_pow_lpm=(isInteger(degree_lpm)),
dont_use_pow_upm=(isInteger(degree_upm)),
d_lpm_0=(degree_lpm==0), d_upm_0=(degree_upm==0);
for(size_t i=0; i<min_size; i++){
double x1=(target_x-x[i]);

double y1=(y[i]-target_y);

if(d_lpm_0) x1 = (x1 >= 0 ? 1 : x1);
if(d_upm_0) y1 = (y1 > 0 ? 1 : y1);

x1 = (x1 < 0 ? 0 : x1);
y1 = (y1 < 0 ? 0 : y1);

if(dont_use_pow_lpm && dont_use_pow_upm){
if(!d_upm_0) x1 = repeatMultiplication(x1, static_cast<int>(degree_lpm));
if(!d_lpm_0) y1 = repeatMultiplication(y1, static_cast<int>(degree_upm));
if(!d_lpm_0) x1 = repeatMultiplication(x1, static_cast<int>(degree_lpm));
if(!d_upm_0) y1 = repeatMultiplication(y1, static_cast<int>(degree_upm));
out += x1 * y1;
} else if(dont_use_pow_lpm && !dont_use_pow_upm){
if(!d_lpm_0) y1 = repeatMultiplication(y1, static_cast<int>(degree_upm));
if(!d_upm_0) y1 = repeatMultiplication(y1, static_cast<int>(degree_upm));
out += fastPow(x1, degree_lpm) * y1;
} else if(dont_use_pow_upm && !dont_use_pow_lpm){
if(!d_upm_0) x1 = repeatMultiplication(x1, static_cast<int>(degree_lpm));
if(!d_lpm_0) x1 = repeatMultiplication(x1, static_cast<int>(degree_lpm));
out += x1 * fastPow(y1, degree_upm);
} else out += fastPow(x1, degree_lpm) * fastPow(y1, degree_upm);
}
Expand Down
Binary file modified src/partial_moments.o
Binary file not shown.

0 comments on commit 00b1f0e

Please sign in to comment.