Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Chris Müller
crystal
Commits
77a9509f
Commit
77a9509f
authored
Oct 26, 2012
by
Chris Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: remove matrix module.
parent
64798a11
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
187 deletions
+5
-187
src/CMakeLists.txt
src/CMakeLists.txt
+0
-2
src/matrix.c
src/matrix.c
+0
-127
src/matrix.h
src/matrix.h
+0
-58
src/structures/array.h
src/structures/array.h
+5
-0
No files found.
src/CMakeLists.txt
View file @
77a9509f
set
(
SOURCES
matrix.c
unittest.c
structures/single_linked_list.c
structures/double_linked_list.c
...
...
@@ -9,7 +8,6 @@ set(SOURCES
set
(
HEADER
standard.h
unix_colors.h
matrix.h
unittest.h
structures/array.h
structures/stack.h
...
...
src/matrix.c
deleted
100644 → 0
View file @
64798a11
/*
* Copyright (c) 2012 Christoph Mueller <ruunhb@googlemail.com>
*
* Crystal is free software: you can redistribute it and/or modify
* it under the terms of the Lesser GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Crystal is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Lesser GNU General Public License for more details.
*
* You should have received a copy of the Lesser GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include "matrix.h"
struct
CrySingleMatrix
cry_singlematrix_new
(
unsigned
int
rows
,
unsigned
int
cols
,
float
value
)
{
float
*
p
=
0
;
float
*
data
=
cry_calloc
(
float
,
rows
*
cols
);
struct
CrySingleMatrix
matrix
=
{
.
data
=
data
,
.
rows
=
rows
,
.
cols
=
cols
};
for
(
p
=
data
;
p
<
data
+
rows
*
cols
;
++
p
)
*
p
=
value
;
return
matrix
;
}
struct
CryDoubleMatrix
cry_doublematrix_new
(
unsigned
int
rows
,
unsigned
int
cols
,
double
value
)
{
double
*
p
=
0
;
double
*
data
=
cry_calloc
(
double
,
rows
*
cols
);
struct
CryDoubleMatrix
matrix
=
{
.
data
=
data
,
.
rows
=
rows
,
.
cols
=
cols
};
for
(
p
=
data
;
p
<
data
+
rows
*
cols
;
++
p
)
*
p
=
value
;
return
matrix
;
}
void
cry_singlematrix_print
(
FILE
*
io
,
struct
CrySingleMatrix
matrix
)
{
float
*
p
=
0
;
for
(
p
=
matrix
.
data
;
p
<
matrix
.
data
+
matrix
.
rows
*
matrix
.
cols
;
++
p
)
{
size_t
offset
=
((
p
-
matrix
.
data
)
/
sizeof
(
float
));
fprintf
(
io
,
"%#f9.3"
);
if
(
offset
%
matrix
.
cols
>=
matrix
.
cols
-
1
)
fprintf
(
io
,
"
\n
"
);
}
}
void
cry_doublematrix_print
(
FILE
*
io
,
struct
CryDoubleMatrix
matrix
)
{
double
*
p
=
0
;
for
(
p
=
matrix
.
data
;
p
<
matrix
.
data
+
matrix
.
rows
*
matrix
.
cols
;
++
p
)
{
size_t
offset
=
((
p
-
matrix
.
data
)
/
sizeof
(
double
));
fprintf
(
io
,
"%#lf9.3"
);
if
(
offset
%
matrix
.
cols
>=
matrix
.
cols
-
1
)
fprintf
(
io
,
"
\n
"
);
}
}
/*
CrySingleMatrix
cry_singlematrix_identity_new(unsigned int dim)
{
double* p = 0;
double* data = cry_calloc(float, dim * dim);
CrySingleMatrix matrix = { .data = data, .rows = dim, .cols = dim };
for(p = data; p < data + dim * dim;
}
CryDoubleMatrix
cry_doublematrix_identity_new(unsigned int dim)
{
}
*/
/*
CrySingleMatrix
cry_singlematrix_from_io(FILE* io)
{
}
CryDoubleMatrix
cry_doublematrix_from_io(FILE* io)
{
}
void
cry_singlematrix_free(CrySingleMatrix matrix)
{
}
void
cry_doublematrix_free(CryDoubleMatrix matrix)
{
}
*/
src/matrix.h
deleted
100644 → 0
View file @
64798a11
/*
* Copyright (c) 2012 Christoph Mueller <ruunhb@googlemail.com>
*
* Crystal is free software: you can redistribute it and/or modify
* it under the terms of the Lesser GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Crystal is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Lesser GNU General Public License for more details.
*
* You should have received a copy of the Lesser GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef CRYSTAL_MACHINELEARNING_MATRIX_H
#define CRYSTAL_MACHINELEARNING_MATRIX_H
#include "standard.h"
struct
CrySingleMatrix
{
float
*
data
;
unsigned
int
rows
;
unsigned
int
cols
;
};
struct
CryDoubleMatrix
{
double
*
data
;
unsigned
int
rows
;
unsigned
int
cols
;
};
crydefine__tuple
(
struct
CrySingleMatrix
,
tuple_singlematrix
);
crydefine__tuple
(
struct
CryDoubleMatrix
,
tuple_doublematrix
);
struct
CrySingleMatrix
cry_singlematrix_new
(
unsigned
int
rows
,
unsigned
int
cols
,
float
value
);
struct
CryDoubleMatrix
cry_doublematrix_new
(
unsigned
int
rows
,
unsigned
int
cols
,
double
value
);
void
cry_singlematrix_print
(
FILE
*
io
,
struct
CrySingleMatrix
matrix
);
void
cry_doublematrix_print
(
FILE
*
io
,
struct
CryDoubleMatrix
matrix
);
/*
CrySingleMatrix cry_singlematrix_identity_new(unsigned int dim);
CryDoubleMatrix cry_doublematrix_identity_new(unsigned int dim);
CrySingleMatrix cry_singlematrix_from_io(FILE* io);
CryDoubleMatrix cry_doublematrix_from_io(FILE* io);
cry_singlematrix_free(CrySingleMatrix matrix);
void cry_doublematrix_free(CryDoubleMatrix matrix);
*/
#endif // CRYSTAL_MACHINELEARNING_MATRIX_H
src/structures/array.h
View file @
77a9509f
...
...
@@ -36,6 +36,11 @@ struct CryArray;
* \return the reference pointer to the constructed array, used by other array calls.
*/
struct
CryArray
*
cry_array_new
(
size_t
initialsize
,
size_t
extend
);
/**
* Release all allocated memory for a created Array.
* \param array using array that should be freed
*/
void
cry_array_free
(
struct
CryArray
*
array
);
size_t
cry_array_size
(
struct
CryArray
*
array
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment