Skip to content

Commit 442e975

Browse files
committed
bugfix RelativeDifference, Optional parameter
1 parent 0b35762 commit 442e975

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@
3939
/.Rproj.user/shared/notebooks/A3951B6D-DatabionicSwarm/1/s/chunks.json
4040
/.Rproj.user/shared/notebooks/patch-chunk-names
4141
/.Rproj.user/shared/notebooks/paths
42+
.Rproj.user
43+
/*.Rhistory

R/RelativeDifference.R

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ RelativeDifference=function(X,Y,epsilon=10^-10,na.rm=FALSE,Silent=FALSE){
55
Y <- Y[noNaNInd]
66
}
77
if(length(X)!=length(Y)) stop('Length of X and Y do not match.')
8-
if(length(X)>1) return(mapply(X,FUN = RelativeDifference,Y))
8+
if(length(X)>1) return(mapply(X,FUN = RelativeDifference,Y,epsilon=epsilon,na.rm=na.rm,Silent=Silent))
99
oben=Y-X
1010
unten=X+Y
1111
if(!is.finite(unten)) stop('Some of your values are not finite. Please use na.rm=TRUE')
1212
if(abs(unten)<epsilon){
13-
if(isFALSE(Silent))
13+
if(isFALSE(Silent)){
1414
message('RelativeDifference: X + Y are smaller than epsilon, returning 0')
15+
}
1516

1617
return(0)
1718
}

inst/NEWS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Version 1.3.0 (2023-10-30 GitHub)
22
o Major bugfix of Quirin Stier in calcStressC.cpp and PswarmCurrentRadiusC2botsPositive: swarm allows every databot to change position by checking a new index. Priorly, databot with index 0 was frozen in the projection.
3-
o RelativeDifference can now be called silent
3+
o RelativeDifference can now be called silent and as a bugfix for vectors x and y optional parameter are now used
44

55
Version 1.2.1 (2023-10-10 CRAN)
66
o Moved RobustNormalization and RobustNorm_BackTrafo to DataVisualizations package available on CRAN

0 commit comments

Comments
 (0)