Skip to content

Instantly share code, notes, and snippets.

View gidili's full-sized avatar
🐢
Probably eating pizza 🍕

Giovanni Idili gidili

🐢
Probably eating pizza 🍕
View GitHub Profile
@gidili
gidili / java-cl-byte-ordering.java
Created June 28, 2012 12:35
JavaCL with byte ordering
CLContext context = JavaCL.createBestContext(DeviceFeature.GPU);
CLQueue queue = context.createDefaultQueue();
ByteOrder byteOrder = context.getByteOrder();
// Read the program sources and compile them :
String src = IOUtils.readText(SampleSolverService.class.getResource(KERNEL_PATH));
CLProgram program = context.createProgram(src);
// I/O BUFFERS DECLARATION
Pointer<Float> I_in_Ptr = allocateFloats(ELEM_COUNT).order(byteOrder);
@gidili
gidili / javacl-warnings.txt
Created June 28, 2012 12:10
JavaCL warnings
Jun 28, 2012 1:04:08 PM com.nativelibs4java.opencl.JavaCL log
WARNING: At least one OpenCL platform uses OpenCL 1.0, which is not thread-safe: will use (slower) synchronized low-level bindings.
Jun 28, 2012 1:04:08 PM org.bridj.AbstractBridJRuntime log
SEVERE: Failed to get address of method public synchronized native long com.nativelibs4java.opencl.library.OpenCLLibrary$SynchronizedNative.clCreateSubBuffer(long,long,int,long,long)
Jun 28, 2012 1:04:08 PM org.bridj.AbstractBridJRuntime log
SEVERE: Failed to get address of method public synchronized native int com.nativelibs4java.opencl.library.OpenCLLibrary$SynchronizedNative.clSetMemObjectDestructorCallback(long,long,long)
Jun 28, 2012 1:04:08 PM org.bridj.AbstractBridJRuntime log
SEVERE: Failed to get address of method public synchronized native long com.nativelibs4java.opencl.library.OpenCLLibrary$SynchronizedNative.clCreateUserEvent(long,long)
Jun 28, 2012 1:04:08 PM org.bridj.AbstractBridJRuntime log
SEVERE: Failed to get address of method public synchro
@gidili
gidili / c_elegans.txt
Created May 20, 2011 15:56
Interesting quotes regarding C. elegans stuff
"While the connectivity of the head circuit for locomotion is known, the roles of the individual neurons are somewhat unclear. One contributing factor is that the dense packing of neurons in the nerve ring makes laser ablation of specific cells more difficult."
"When a healthy worm is touched on the nose, it will immediately start backing up [24]. Similarly if touched on the tail, it will reverse direction if currently backing up, and will accelerate if going forward"
Source: http://www.comp.leeds.ac.uk/jboyle/JordanBoyle_files/J_Boyle_PhD.pdf
function [ fitness ] = majorityClassificationFitness( rule , varargin )
%CALCULATEFITNESS
% this function calculates performance fitness of given rule - returns a
% scalar calculated as successfulRuns/TotalRuns. Takes a 128 bits vector
% representing a CA rule for a neighborhood of radius 3.
% Note: A lot of (if not all) the costants declared here could be passed down as
% parameters - but since this is going to be used as the fitness function
% in a Genetic Algorithm very specific to the problem at hand to be called
% from the matlab Genetic Algorithm toolkit, it is more practical to pass
% down as input param only the transformation rule.
function [ fitness ] = majorityClassificationFitness( rule , varargin )
%CALCULATEFITNESS
% this function calculates performance fitness of given rule - returns a
% scalar calculated as successfulRuns/TotalRuns. Takes a 128 bits vector
% representing a CA rule for a neighborhood of radius 3.
% Note: A lot of (if not all) the costants declared here could be passed down as
% parameters - but since this is going to be used as the fitness function
% in a Genetic Algorithm very specific to the problem at hand to be called
% from the matlab Genetic Algorithm toolkit, it is more practical to pass
% down as input param only the transformation rule.
function [ fitness ] = majorityClassificationFitness( rule , varargin )
%CALCULATEFITNESS
% this function calculates performance fitness of given rule - returns a
% scalar calculated as successfulRuns/TotalRuns. Takes a 128 bits vector
% representing a CA rule for a neighborhood of radius 3.
% Note: A lot of (if not all) the costants declared here could be passed down as
% parameters - but since this is going to be used as the fitness function
% in a Genetic Algorithm very specific to the problem at hand to be called
% from the matlab Genetic Algorithm toolkit, it is more practical to pass
% down as input param only the transformation rule.
public enum TweetSectionType { NormalText, Url, AtName, HashCode }
public class TweetSection
{
public TweetSectionType SectionType;
public string Text;
}
public class TweetDecoder
{
public enum TweetSectionType { NormalText, Url, AtName, HashCode }
public class TweetSection
{
public TweetSectionType SectionType;
public string Text;
}
public class TweetDecoder
{
function [ Population ] = genHighDiversityPop(GenomeLength, FitnessFcn, options)
%generateHighDensityPopulation generates initial population of rules
% This function generates popSize rules of size chromSize. The rules are
% generated with pseudo-uniform distribution of densitites of 1s, spanning from
% very low to very high as this facilitates evolution.
%constants
chromSize = GenomeLength;
popSize = 100;
function [ fitness ] = majorityClassificationFitness( rule , varargin )
%CALCULATEFITNESS
% this function calculates performance fitness of given rule - returns a
% scalar calculated as successfulRuns/TotalRuns. Takes a 128 bits vector
% representing a CA rule for a neighborhood of radius 3.
% Note: A lot of (if not all) the costants declared here could be passed down as
% parameters - but since this is going to be used as the fitness function
% in a Genetic Algorithm very specific to the problem at hand to be called
% from the matlab Genetic Algorithm toolkit, it is more practical to pass
% down as input param only the transformation rule.