1
      	ˆ¿‘äÇò 8àdi’n:FÿŸÉƒh¹È¾Å      	01
     ˆÀ�þ_ŽE›‘Öœ„Œ�ÏÉƒO³È¾Å 	½    suppressMessages(library(doSNOW))
cl <- makeSOCKcluster(4)
registerDoSNOW(cl)

cat(sprintf('doSNOW %s\n', packageVersion('doSNOW')))
junk <- matrix(0, 1000000, 8)
cat(sprintf('Size of extra junk data: %d bytes\n', object.size(junk)))

x <- iris[which(iris[,5] != "setosa"), c(1,5)]

trials <- 10000

ptime <- system.time({
  r <- foreach(icount(trials), .combine=cbind,
               .export='junk') %dopar% {
    ind <- sample(100, 100, replace=TRUE)
    result1 <- glm(x[ind,2]~x[ind,1], family=binomial(logit))
    coefficients(result1)
  }
})[3]
cat(sprintf('parallel foreach:                    %6.1f sec\n', ptime))

ptime2 <- system.time({
  snowopts <- list(preschedule=TRUE)
  r <- foreach(icount(trials), .combine=cbind,
               .export='junk', .options.snow=snowopts) %dopar% {
    ind <- sample(100, 100, replace=TRUE)
    result1 <- glm(x[ind,2]~x[ind,1], family=binomial(logit))
    coefficients(result1)
  }
})[3]
cat(sprintf('parallel foreach with prescheduling: %6.1f sec\n', ptime2))

ptime3 <- system.time({
  chunks <- getDoParWorkers()
  r <- foreach(n=idiv(trials, chunks=chunks), .combine=cbind,
               .export='junk') %dopar% {
    y <- lapply(seq_len(n), function(i) {
      ind <- sample(100, 100, replace=TRUE)
      result1 <- glm(x[ind,2]~x[ind,1], family=binomial(logit))
      coefficients(result1)
    })
    do.call('cbind', y)
  }
})[3]
cat(sprintf('chunked parallel foreach:            %6.1f sec\n', ptime3))

ptime4 <- system.time({
  mkworker <- function(x, junk) {
    force(x)
    force(junk)
    function(i) {
      ind <- sample(100, 100, replace=TRUE)
      result1 <- glm(x[ind,2]~x[ind,1], family=binomial(logit))
      coefficients(result1)
    }
  }
  y <- parLapply(cl, seq_len(trials), mkworker(x, junk))
  r <- do.call('cbind', y)
})[3]
cat(sprintf('parLapply:                           %6.1f sec\n', ptime4))

stime <- system.time({
  y <- lapply(seq_len(trials), function(i) {
    ind <- sample(100, 100, replace=TRUE)
    result1 <- glm(x[ind,2]~x[ind,1], family=binomial(logit))
    coefficients(result1)
  })
  r <- do.call('cbind', y)
})[3]
cat(sprintf('sequential lapply:                   %6.1f sec\n', stime))

stime2 <- system.time({
  r <- foreach(icount(trials), .combine=cbind) %do% {
    ind <- sample(100, 100, replace=TRUE)
    result1 <- glm(x[ind,2]~x[ind,1], family=binomial(logit))
    coefficients(result1)
  }
})[3]
cat(sprintf('sequential foreach:                  %6.1f sec\n', stime2))

stopCluster(cl)
  @   ˆl–ßi~”ªC]Š€À†àS�ÿ�þCÄY§›�…ð¶�üÿÊƒt‹É_ˆI|¥�+$¾ÀÇ Œ    % 
% 
%  Style for  FSB Math docs
% 
% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fsbmath}[2010/04/09 v0.31 LaTeX Macros for FSB Math Dept, University of Zagreb]
			

\RequirePackage{amsmath, amsthm, amssymb}
% \RequirePackage{esvect}
%\RequirePackage{theorem}



\RequirePackage[dvips]{graphicx}
\RequirePackage[default, rjesenja]{optional}


\RequirePackage{calc}
\RequirePackage{ifthen}

\RequirePackage[enc=cp1250]{hrlatex}


\RequirePackage{framed}
% \RequirePackage{picins}
\RequirePackage{multicol}



\RequirePackage{enumerate}
\RequirePackage{paralist}


\RequirePackage{xcolor}



% \RequirePackage{pst-plot}
% \RequirePackage{pstricks-add}
% \RequirePackage{pstricks, pst-node, pst-tree}

\RequirePackage{cancel}


% \RequirePackage{txfonts}

\RequirePackage[%
	linkcolor=blue,%
	urlcolor=blue,%
	colorlinks,%
% 	breaklinks,%
]{hyperref}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\R}{\mathbb{R}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\D}{\displaystyle}
\newcommand{\F}{\mathbf{F}}

\renewcommand{\Re}{\mathop{\textrm{Re}}}
\renewcommand{\Im}{\mathop{\textrm{Im}}}
\newcommand{\Ln}{\mathop{\textrm{Ln}}}
\newcommand{\Arg}{\mathop{\textrm{Arg}}}
% \newcommand{\ch}{\mathop{\textrm{ch}}}
% \newcommand{\sh}{\mathop{\textrm{sh}}}



\newcommand{\hpm}{\ensuremath{\hphantom{-}}}


\newcommand{\eqdef}