This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function forkjulia() | |
r = ccall((:fork, "libc"), Int32, ()) | |
if r != 0 | |
# parent | |
returnstatus=0 | |
ccall((:waitpid, "libc"), Int32, (Int32, Ptr{Int32}, Int32), r, &returnstatus, 0) | |
println("forkjulia: return status: $returnstatus") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Lazy quicksort. | |
# Can be used to take only the first k elements of the sorted array, | |
# And will do this 'efficiently' | |
lazysort{T}(lst::Vector{T}) = | |
@task begin | |
if length(lst) == 0 # is sorting trivial? | |
elseif length(lst) == 1 | |
produce(lst[1]) | |
else | |
# take pivot element |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# T: type of underlying data | |
# N: dimensionality of filter | |
type ConvolveFilter{T,N} | |
fk::Array{Complex{T},N} | |
end | |
# apply a filter to data. | |
# If the dimensionality of the data (M) is larger than the filter (N), | |
# then apply the filter to the first N dimensions of the data. | |
*{T,N,M}(f::ConvolveFilter{T,N},x::Array{T,M}) = real(ifft(conj(f.fk) .* fft(x,1:N), 1:N)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import types | |
import tensorflow as tf | |
import numpy as np | |
# Expressions are represented as lists of lists, | |
# in lisp style -- the symbol name is the head (first element) | |
# of the list, and the arguments follow. | |
# add an expression to an expression list, recursively if necessary. | |
def add_expr_to_list(exprlist, expr): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy import misc | |
from scipy.ndimage import filters | |
import numpy as np | |
import tensorflow as tf | |
#from inception import image_processing | |
from inception import inception_model as inception | |
#from PIL import Image | |
#from PIL import ImageFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code implements the model outlined in: | |
# "Design of conditions for emergence of self-replicators" | |
# by Sarkar, Wang, and England (2018) | |
# Reduced, one-atom model, | |
# using 'mechanistic' transition-state modeling | |
using ChemicalReactionNetworks | |
using PyPlot | |
#using ODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ollama | |
import feedparser | |
import time | |
from datetime import datetime | |
sys_prompt = """ | |
Your task is to judge whether an article title and abstract appeals to a specific researcher. This researcher specializes in computational modeling and analysis of complex biological systems, with particular focus on: | |
.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.distributed as dist | |
def main(rank, world_size): | |
# Initialize distributed environment | |
dist.init_process_group(backend='gloo', init_method='env://', rank=rank, world_size=world_size) | |
# Determine neighbor ranks | |
prev_rank = (rank - 1) % world_size | |
next_rank = (rank + 1) % world_size |