Skip to content

Commit

Permalink
First working version at GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
jpzm committed Feb 26, 2014
1 parent 5493f76 commit 85ef84b
Show file tree
Hide file tree
Showing 65 changed files with 482 additions and 371 deletions.
File renamed without changes.
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ default: all

all:
cd code; cc -ggdb -Wall -shared -fPIC -c *.c
cd test; cc -ggdb -Wall -lm matrix.c -o matrix \
cd test; cc -ggdb -Wall matrix.c -o matrix \
../code/matrix.o \
../code/clann.o \
../code/reader.o
cd test; cc -ggdb -Wall -lm fft.c -o fft \
../code/reader.o -lm
cd test; cc -ggdb -Wall fft.c -o fft \
../code/fft.o \
../code/matrix.o \
../code/clann.o \
../code/statistic.o \
../code/reader.o
cd test; cc -ggdb -Wall -lm lms.c -o lms \
../code/reader.o -lm
cd test; cc -ggdb -Wall lms.c -o lms \
../code/matrix.o \
../code/clann.o \
../code/function.o \
../code/lms.o \
../code/neuron.o
cd test; cc -ggdb -Wall -lm rbf.c -o rbf \
../code/neuron.o -lm
cd test; cc -ggdb -Wall rbf.c -o rbf \
../code/rbf.o \
../code/kmeans.o \
../code/matrix.o \
Expand All @@ -27,15 +27,15 @@ all:
../code/function.o \
../code/clann.o \
../code/lms.o \
../code/reader.o
cd test; cc -ggdb -Wall -lm svm.c -o svm \
../code/reader.o -lm
cd test; cc -ggdb -Wall svm.c -o svm \
../code/svm.o \
../code/ilpso.o \
../code/matrix.o \
../code/neuron.o \
../code/function.o \
../code/clann.o \
../code/reader.o
../code/reader.o -lm
cd test; cc -Wall som.c -lpthread -lglut -o som \
../code/clann.o \
../code/som.o \
Expand All @@ -53,6 +53,6 @@ clean:
rbf \
svm \
som
cd bind; rm -rf clann/*.so \
cd bind; rm -rf clann/*.so clann/*.pyc \
rm -rf build/

12 changes: 5 additions & 7 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ INTRODUCTION

CLANN stands for `C library for Learning Appliance and Neural Networks'.
Its was developed in a mastering engineering course of Artificial Neural
Networks at the Federal University of Rio Grande do Norte (UFRN) [0]. In this
Networks at the Federal University of Rio Grande do Norte (UFRN). In this
course we have a very extensive and intensive teaching in both supervised and
non-supervised learning techniques. The choice of C language was made based on
its fastness, portability and embeddable capabilities. Mode information about
CLANN could be find on its site [1] and repository [2].
its fastness, portability and embeddable capabilities. More information about
CLANN could be find on its repository [0].


BUILD
Expand All @@ -24,12 +24,10 @@ CONTACT

If you have any question about CLANN, send an e-mail to the contact below.

Joao Paulo de Souza Medeiros <joaomedeiros@ufrnet.br>
Joao Paulo de Souza Medeiros <ignotus21@gmail.com>


REFERENCES
==========

[0] http://www.ufrn.br/
[1] http://labepi.cerescaico.ufrn.br/~jpsm/clann/
[2] http://labepi.cerescaico.ufrn.br/redmine/projects/clann/
[0] https://github.com/jpzm/clann/
4 changes: 2 additions & 2 deletions bind/clann/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (C) 2009 Adriano Monteiro Marques
# Copyright (C) 2009-2014 Joao Paulo de Souza Medeiros
#
# Author: Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
# Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
29 changes: 15 additions & 14 deletions bind/clann/matrix.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (C) 2009 Adriano Monteiro Marques
# Copyright (C) 2009-2014 Joao Paulo de Souza Medeiros
#
# Author: Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
# Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -21,24 +21,25 @@

import clann.matrix


class Matrix(object):
"""
"""
def __init__(self, rows=0, cols=0, fill=0):
"""
"""
self.matrix = clann.matrix.new(rows, cols)
clann.matrix.fill(self.matrix, fill)
self.__matrix = clann.matrix.new(rows, cols)
clann.matrix.fill(self.__matrix, fill)

def __nonzero__(self):
"""
"""
return clann.matrix.isnull(self.matrix)
return clann.matrix.isnull(self.__matrix)

def __len__(self):
"""
"""
return sum(clann.matrix.size(self.matrix))
return sum(clann.matrix.size(self.__matrix))

def __getitem__(self, key):
"""
Expand All @@ -47,7 +48,7 @@ def __getitem__(self, key):
raise IndexError, "invalid index size"

i, j = key
return clann.matrix.get(self.matrix, i, j)
return clann.matrix.get(self.__matrix, i, j)

def __setitem__(self, key, value):
"""
Expand All @@ -56,28 +57,28 @@ def __setitem__(self, key, value):
raise IndexError, "invalid index size"

i, j = key
return clann.matrix.set(self.matrix, i, j, value)
return clann.matrix.set(self.__matrix, i, j, value)

def __add__(self, m):
"""
"""
n = Matrix()
n.matrix = clann.matrix.add(self.matrix, m.matrix)
n.matrix = clann.matrix.add(self.__matrix, m.matrix)

return n

def __sub__(self, m):
"""
"""
n = Matrix()
n.matrix = clann.matrix.subtract(self.matrix, m.matrix)
n.matrix = clann.matrix.subtract(self.__matrix, m.matrix)

return n

def __mul__(self, m):
"""
"""
n = Matrix()
n.matrix = clann.matrix.product(self.matrix, m.matrix)
n.matrix = clann.matrix.product(self.__matrix, m.matrix)

return n
2 changes: 1 addition & 1 deletion bind/matrix.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2009 Adriano Monteiro Marques
* Copyright (C) 2009-2014 Joao Paulo de Souza Medeiros
*
* Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
*
Expand Down
5 changes: 2 additions & 3 deletions bind/matrix.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2009 Adriano Monteiro Marques
* Copyright (C) 2009-2014 Joao Paulo de Souza Medeiros
*
* Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
*
Expand Down Expand Up @@ -119,8 +119,7 @@ inverse(PyObject *self, PyObject *args);
/**
*
*/
static char pseudo_inverse__doc__[] = "Create a pseudo inverse for a given \
matrix";
static char pseudo_inverse__doc__[] = "Compute the pseudo inverse of a matrix";

static PyObject*
pseudo_inverse(PyObject *self, PyObject *args);
Expand Down
2 changes: 1 addition & 1 deletion bind/metric.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2009 Adriano Monteiro Marques
* Copyright (C) 2009-2014 Joao Paulo de Souza Medeiros
*
* Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
*
Expand Down
2 changes: 1 addition & 1 deletion bind/metric.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2009 Adriano Monteiro Marques
* Copyright (C) 2009-2014 Joao Paulo de Souza Medeiros
*
* Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
*
Expand Down
7 changes: 4 additions & 3 deletions bind/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (C) 2009 Adriano Monteiro Marques
# Copyright (C) 2009-2014 Joao Paulo de Souza Medeiros
#
# Author: Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
# Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -28,7 +28,8 @@
metric_module = Extension('metric',
include_dirs = ['../'],
extra_objects = ['../code/metric.o',
'../code/matrix.o'],
'../code/matrix.o',
'../code/clann.o'],
extra_compile_args = ['-Wall', '-ggdb'],
sources = ['metric.c'])

Expand Down
5 changes: 2 additions & 3 deletions code/backprop.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**
* Copyright (C) 2008 Joao Paulo de Souza Medeiros
* Copyright (C) 2009 Adriano Monteiro Marques
* Copyright (C) 2008-2014 Joao Paulo de Souza Medeiros
*
* Author(s): João Paulo de Souza Medeiros <ignotus21@gmail.com>
* Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
15 changes: 7 additions & 8 deletions code/backprop.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**
* Copyright (C) 2008 Joao Paulo de Souza Medeiros
* Copyright (C) 2009 Adriano Monteiro Marques
* Copyright (C) 2008-2014 Joao Paulo de Souza Medeiros
*
* Author(s): João Paulo de Souza Medeiros <ignotus21@gmail.com>
* Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -32,7 +31,7 @@
/**
* Adjust weights function
*/
inline void
void
backprop_adjust_weights(struct neuron *n,
const clann_real_type *y,
const clann_real_type *g,
Expand All @@ -42,7 +41,7 @@ backprop_adjust_weights(struct neuron *n,
/**
*
*/
inline void
void
backprop_learn(struct mlp *ann,
const clann_real_type *x,
const clann_real_type *d,
Expand All @@ -52,7 +51,7 @@ backprop_learn(struct mlp *ann,
/**
*
*/
inline void
void
backprop_learn_epoch(struct mlp *ann,
const struct matrix *x,
const struct matrix *d,
Expand Down Expand Up @@ -88,7 +87,7 @@ backprop_train_with_validation(struct mlp *ann,
/**
*
*/
inline void
void
backprop_backward_computation(struct mlp *ann,
const clann_real_type *x,
const clann_real_type *d,
Expand All @@ -98,7 +97,7 @@ backprop_backward_computation(struct mlp *ann,
/**
*
*/
inline void
void
backprop_compute_gradient(struct mlp *ann,
const unsigned int l,
const unsigned int j,
Expand Down
3 changes: 1 addition & 2 deletions code/clann.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* Copyright (C) 2008 Joao Paulo de Souza Medeiros
* Copyright (C) 2009 Adriano Monteiro Marques
* Copyright (C) 2008-2014 Joao Paulo de Souza Medeiros
*
* Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
*
Expand Down
19 changes: 9 additions & 10 deletions code/clann.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**
* Copyright (C) 2008--2011 Joao Paulo de Souza Medeiros
* Copyright (C) 2009 Adriano Monteiro Marques
* Copyright (C) 2008-2014 Joao Paulo de Souza Medeiros
*
* Author(s): João Paulo de Souza Medeiros <ignotus21@gmail.com>
* Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -60,26 +59,26 @@ typedef enum {off, on} clann_key_type;
/**
*
*/
inline void
void
clann_shuffle(clann_int_type *list,
clann_size_type length);

/**
*
*/
inline void
void
clann_initialize(void);

/**
*
*/
inline clann_real_type
clann_real_type
clann_nrand(void);

/**
*
*/
inline clann_real_type
clann_real_type
clann_rand(const clann_real_type min,
const clann_real_type max);

Expand All @@ -93,20 +92,20 @@ clann_randint(const clann_int_type min,
/**
*
*/
inline clann_real_type
clann_real_type
clann_factorial(const clann_uint_type v);

/**
*
*/
inline clann_real_type
clann_real_type
clann_binomial(const clann_uint_type n,
const clann_uint_type k);

/**
*
*/
inline clann_uint_type
clann_uint_type
clann_nextpow2(clann_uint_type n);

#endif
5 changes: 2 additions & 3 deletions code/dprog.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**
* Copyright (C) 2008 Joao Paulo de Souza Medeiros
* Copyright (C) 2009 Adriano Monteiro Marques
* Copyright (C) 2008-2014 Joao Paulo de Souza Medeiros
*
* Author(s): João Paulo de Souza Medeiros <ignotus21@gmail.com>
* Author(s): Joao Paulo de Souza Medeiros <ignotus21@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
Loading

0 comments on commit 85ef84b

Please sign in to comment.