libuproc  1.2.0
matrix.h
Go to the documentation of this file.
1 /* Copyright 2014 Peter Meinicke, Robin Martinjak
2  *
3  * This file is part of libuproc.
4  *
5  * libuproc is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License as published by the Free
7  * Software Foundation, either version 3 of the License, or (at your option)
8  * any later version.
9  *
10  * libuproc is distributed in the hope that it will be useful, but WITHOUT ANY
11  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libuproc. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
30 #ifndef UPROC_THRESHOLDS_H
31 #define UPROC_THRESHOLDS_H
32 
33 #include <stdlib.h>
34 #include <stdarg.h>
35 #include "uproc/io.h"
36 
55 typedef struct uproc_matrix_s uproc_matrix;
56 
68 uproc_matrix *uproc_matrix_create(unsigned long rows, unsigned long cols,
69  const double *values);
70 
73 
75 void uproc_matrix_set(uproc_matrix *matrix, unsigned long row,
76  unsigned long col, double value);
77 
79 double uproc_matrix_get(const uproc_matrix *matrix, unsigned long row,
80  unsigned long col);
81 
88 void uproc_matrix_dimensions(const uproc_matrix *matrix, unsigned long *rows,
89  unsigned long *cols);
90 
93 
100 uproc_matrix *uproc_matrix_load(enum uproc_io_type iotype, const char *pathfmt,
101  ...);
102 
108 uproc_matrix *uproc_matrix_loadv(enum uproc_io_type iotype, const char *pathfmt,
109  va_list ap);
110 
112 int uproc_matrix_stores(const uproc_matrix *matrix, uproc_io_stream *stream);
113 
115 int uproc_matrix_store(const uproc_matrix *matrix, enum uproc_io_type iotype,
116  const char *pathfmt, ...);
117 
123 int uproc_matrix_storev(const uproc_matrix *matrix, enum uproc_io_type iotype,
124  const char *pathfmt, va_list ap);
131 #endif
void uproc_matrix_destroy(uproc_matrix *matrix)
Destroy matrix object.
double uproc_matrix_get(const uproc_matrix *matrix, unsigned long row, unsigned long col)
Get the value of matrix[row, col].
uproc_matrix * uproc_matrix_loads(uproc_io_stream *stream)
Load matrix from stream.
uproc_matrix * uproc_matrix_load(enum uproc_io_type iotype, const char *pathfmt,...)
Load matrix from file.
uproc_matrix * uproc_matrix_loadv(enum uproc_io_type iotype, const char *pathfmt, va_list ap)
Load matrix from file.
int uproc_matrix_stores(const uproc_matrix *matrix, uproc_io_stream *stream)
Store matrix to stream.
Module: General IO.
void uproc_matrix_set(uproc_matrix *matrix, unsigned long row, unsigned long col, double value)
Set the value of matrix[row, col].
2D matrix
Optionally compressed I/O stream.
int uproc_matrix_store(const uproc_matrix *matrix, enum uproc_io_type iotype, const char *pathfmt,...)
Store matrix to file.
void uproc_matrix_dimensions(const uproc_matrix *matrix, unsigned long *rows, unsigned long *cols)
Obtain matrix dimensions.
uproc_matrix * uproc_matrix_create(unsigned long rows, unsigned long cols, const double *values)
Create matrix object.
uproc_io_type
Underlying stream type.
Definition: io.h:59
int uproc_matrix_storev(const uproc_matrix *matrix, enum uproc_io_type iotype, const char *pathfmt, va_list ap)
Store matrix to file.