Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb799769

Browse files
committed
Solve strange non-numericness problem
1 parentd8c0117 commitb799769

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

‎R/optim_nm.R‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ optim_nm <- function(fun, k = 0, start, maximum = FALSE, trace = FALSE, alpha =
104104
trace_array<- rbind(trace_array, c(counter+1,simplex[1],simplex[1,-1]))# writing trace for visulaization
105105
}
106106

107-
R<-M+alpha* (M-simplex[k+1, c(2:(k+1))])# Reflection
107+
R<-as.numeric(M+alpha* (M-simplex[k+1, c(2:(k+1))]))# Reflection
108108
Ry<- fun(R)
109109

110110
if (Ry>simplex[k,1]) {# case 1: Reflection or Expension (correct direction)
@@ -167,7 +167,7 @@ optim_nm <- function(fun, k = 0, start, maximum = FALSE, trace = FALSE, alpha =
167167
kparam<-param[-(k+1)]# extracting the k best vertices from simplex
168168
M<-kparam# calculating the mean of the k best points
169169
}
170-
170+
171171
End<- sqrt(sum((simplex[,1]- fun(M))^2)/ (k+1))# determine the exit out of the loop if a certain accuracy is reache
172172
counter<-0
173173

‎optimization.Rproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ StripTrailingWhitespace: Yes
1818
BuildType: Package
1919
PackageUseDevtools: Yes
2020
PackageInstallArgs: --no-multiarch --with-keep.source
21+
PackageRoxygenize: rd,collate,namespace

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp