~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to lib/gmath/test/test_gmath_lib.h

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*****************************************************************************
 
3
*
 
4
* MODULE:       Grass gmath Library
 
5
* AUTHOR(S):    Soeren Gebbert, Berlin (GER) Oct 2007
 
6
*               soerengebbert <at> gmx <dot> de
 
7
*               
 
8
* PURPOSE:      Unit and Integration tests
 
9
*
 
10
* COPYRIGHT:    (C) 2000 by the GRASS Development Team
 
11
*
 
12
*               This program is free software under the GNU General Public
 
13
*               License (>=v2). Read the file COPYING that comes with GRASS
 
14
*               for details.
 
15
*
 
16
*****************************************************************************/
 
17
 
 
18
#ifndef _TEST_GMATH_LIB_H_
 
19
#define _TEST_GMATH_LIB_H_
 
20
 
 
21
#include <grass/gmath.h>
 
22
#include <grass/gis.h>
 
23
 
 
24
#define TEST_NUM_ROWS 10  
 
25
#define TEST_NUM_COLS 9
 
26
#define TEST_NUM_DEPTHS 8
 
27
 
 
28
#define G_MATH_NORMAL_LES 0
 
29
#define G_MATH_SPARSE_LES 1
 
30
 
 
31
struct timeval;
 
32
 
 
33
typedef struct
 
34
{
 
35
    double *x;                  /*the value vector */
 
36
    double *b;                  /*the right side of Ax = b */
 
37
    double **A;                 /*the normal quadratic matrix */
 
38
    double *data;               /*the pointer to the quadratic matrix data*/
 
39
    G_math_spvector **Asp;              /*the sparse matrix */
 
40
    int rows;                   /*number of rows */
 
41
    int cols;                   /*number of cols */
 
42
    int quad;                   /*is the matrix quadratic (1-quadratic, 0 not)*/
 
43
    int type;                   /*the type of the les, normal == 0, sparse == 1 */
 
44
    int bandwith;               /*the bandwith of the matrix (0 < bandwidth <= cols)*/
 
45
    int symm;                   /*0 if matrix unsymmetric, 1 if symmetric*/
 
46
} G_math_les;
 
47
 
 
48
typedef struct
 
49
{
 
50
    float *x;                   /*the value vector */
 
51
    float *b;                   /*the right side of Ax = b */
 
52
    float **A;                  /*the normal quadratic matrix */
 
53
    float *data;                /*the pointer to the quadratic matrix data*/
 
54
    int rows;                   /*number of rows */
 
55
    int cols;                   /*number of cols */
 
56
    int quad;                   /*is the matrix quadratic (1-quadratic, 0 not)*/
 
57
    int type;                   /*the type of the les, normal == 0, sparse == 1 */
 
58
    int bandwith;               /*the bandwith of the matrix (0 < bandwidth <= cols)*/
 
59
    int symm;                   /*0 if matrix unsymmetric, 1 if symmetric*/
 
60
} G_math_f_les;
 
61
 
 
62
extern G_math_les *G_math_alloc_nquad_les(int cols, int rows, int type);
 
63
extern G_math_les *G_math_alloc_nquad_les_Ax(int cols, int rows, int type);
 
64
extern G_math_les *G_math_alloc_nquad_les_A(int cols, int rows, int type);
 
65
extern G_math_les *G_math_alloc_nquad_les_Ax_b(int cols, int rows, int type);
 
66
extern G_math_les *G_math_alloc_les(int rows, int type);
 
67
extern G_math_les *G_math_alloc_les_Ax(int rows, int type);
 
68
extern G_math_les *G_math_alloc_les_A(int rows, int type);
 
69
extern G_math_les *G_math_alloc_les_Ax_b(int rows, int type);
 
70
extern G_math_les *G_math_alloc_les_param(int cols, int rows, int type, int parts);
 
71
extern int G_math_add_spvector_to_les(G_math_les * les, G_math_spvector * spvector, int row);
 
72
extern void G_math_print_les(G_math_les * les);
 
73
extern void G_math_free_les(G_math_les * les);
 
74
 
 
75
 
 
76
extern void fill_d_vector_range_1(double *x, double a, int rows);
 
77
extern void fill_f_vector_range_1(float *x, float a, int rows);
 
78
extern void fill_i_vector_range_1(int *x, int a, int rows);
 
79
extern void fill_d_vector_range_2(double *x, double a, int rows);
 
80
extern void fill_f_vector_range_2(float *x, float a, int rows);
 
81
extern void fill_i_vector_range_2(int *x, int a, int rows);
 
82
extern void fill_d_vector_scalar(double *x, double a, int rows);
 
83
extern void fill_f_vector_scalar(float *x, float a, int rows);
 
84
extern void fill_i_vector_scalar(int *x, int a, int rows);
 
85
 
 
86
extern G_math_les *create_normal_symmetric_les(int rows);
 
87
extern G_math_les *create_symmetric_band_les(int rows);
 
88
extern G_math_les *create_normal_symmetric_pivot_les(int rows);
 
89
extern G_math_les *create_normal_unsymmetric_les(int rows);
 
90
extern G_math_les *create_sparse_symmetric_les(int rows);
 
91
extern G_math_les *create_sparse_unsymmetric_les(int rows);
 
92
extern G_math_les *create_normal_unsymmetric_nquad_les_A(int rows, int cols);
 
93
 
 
94
 
 
95
/*float*/
 
96
extern G_math_f_les *G_math_alloc_f_les(int rows, int type);
 
97
extern G_math_f_les *G_math_alloc_f_nquad_les_A(int rows, int cols, int type);
 
98
extern G_math_f_les *G_math_alloc_f_les_param(int cols, int rows, int type, int parts);
 
99
extern void G_math_free_f_les(G_math_f_les * les);
 
100
extern G_math_f_les *create_normal_symmetric_f_les(int rows);
 
101
extern G_math_f_les *create_normal_unsymmetric_f_les(int rows);
 
102
extern G_math_f_les *create_normal_unsymmetric_f_nquad_les_A(int rows, int cols);
 
103
 
 
104
/* direct and iterative solvers */
 
105
extern int unit_test_solvers(void);
 
106
 
 
107
/* Test the matrix conversion dense -> band ->sparse and vis versa */
 
108
extern int unit_test_matrix_conversion(void);
 
109
 
 
110
/* ccmath wrapper tests*/
 
111
int unit_test_ccmath_wrapper(void);
 
112
 
 
113
/* blas level 1 routines */
 
114
extern int unit_test_blas_level_1(void);
 
115
 
 
116
/* blas level 2 routines */
 
117
extern int unit_test_blas_level_2(void);
 
118
 
 
119
/* blas level 3 routines */
 
120
extern int unit_test_blas_level_3(void);
 
121
 
 
122
/* benchmarking iterative krylov solvers */
 
123
extern int bench_solvers_krylov(int);
 
124
 
 
125
/* benchmarking direct solvers */
 
126
extern int bench_solvers_direct(int);
 
127
 
 
128
/* benchmarking level 2 blas functions */
 
129
int bench_blas_level_2(int rows); 
 
130
 
 
131
/* benchmarking level 3 blas functions */
 
132
int bench_blas_level_3(int rows); 
 
133
 
 
134
/* Compute time difference */
 
135
extern double compute_time_difference(struct timeval start, struct timeval end);
 
136
 
 
137
#endif