Bug fix with sapply
This commit is contained in:
@@ -67,8 +67,7 @@ pgraphon <- function(
|
|||||||
dev_mat <- outer(y, inner_products, "-")
|
dev_mat <- outer(y, inner_products, "-")
|
||||||
|
|
||||||
# Apply CDF Fv to each deviation
|
# Apply CDF Fv to each deviation
|
||||||
# With sapply we do not have to assume that Fv is vectorized
|
cdf_vals <- Fv(dev_mat)
|
||||||
cdf_values <- sapply(dev_mat, Fv)
|
|
||||||
|
|
||||||
# Row means give the empirical expectation for each y_j
|
# Row means give the empirical expectation for each y_j
|
||||||
out <- rowMeans(cdf_vals)
|
out <- rowMeans(cdf_vals)
|
||||||
@@ -140,8 +139,7 @@ dgraphon <- function(
|
|||||||
dev_mat <- outer(y, inner_products, "-")
|
dev_mat <- outer(y, inner_products, "-")
|
||||||
|
|
||||||
# Apply the density function to each y[j]
|
# Apply the density function to each y[j]
|
||||||
# With sapply we do not have to assume that fv is vectorized
|
dens_vals <- fv(dev_mat)
|
||||||
dens_vals <- sapply(dev_mat, fv)
|
|
||||||
|
|
||||||
# Row means give the empirical expectation for each y_j
|
# Row means give the empirical expectation for each y_j
|
||||||
out <- rowMeans(dens_vals)
|
out <- rowMeans(dens_vals)
|
||||||
|
|||||||
Reference in New Issue
Block a user