SphinxBase 5prealpha
matrix.h
Go to the documentation of this file.
1/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/* ====================================================================
3 * Copyright (c) 1997-2000 Carnegie Mellon University. All rights
4 * reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 *
18 * This work was supported in part by funding from the Defense Advanced
19 * Research Projects Agency and the National Science Foundation of the
20 * United States of America, and the CMU Sphinx Speech Consortium.
21 *
22 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
23 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
26 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 * ====================================================================
35 *
36 */
37/*********************************************************************
38 *
39 * File: matrix.h
40 *
41 * Description: Matrix and linear algebra functions
42 *
43 * Author:
44 *
45 *********************************************************************/
46
47#ifndef MATRIX_H
48#define MATRIX_H
49
60#ifdef __cplusplus
61extern "C" {
62#endif
63#if 0
64/* Fool Emacs. */
65}
66#endif
67
68/* Win32/WinCE DLL gunk */
69#include <sphinxbase/sphinxbase_export.h>
71
72
80SPHINXBASE_EXPORT void norm_3d(float32 ***arr, uint32 d1, uint32 d2, uint32 d3);
81
90SPHINXBASE_EXPORT void
91accum_3d(float32 ***out, float32 ***in, uint32 d1, uint32 d2, uint32 d3);
92
98SPHINXBASE_EXPORT void band_nz_1d(float32 *v, uint32 d1, float32 band);
99
108SPHINXBASE_EXPORT void floor_nz_3d(float32 ***m, uint32 d1, uint32 d2, uint32 d3, float32 floor);
109
116SPHINXBASE_EXPORT void floor_nz_1d(float32 *v, uint32 d1, float32 floor);
117
130SPHINXBASE_EXPORT
131float64 determinant(float32 **a, int32 len);
132
148SPHINXBASE_EXPORT
149int32 invert(float32 **out_ainv, float32 **a, int32 len);
150
162SPHINXBASE_EXPORT
163int32 solve(float32 **a, float32 *b,
164 float32 *out_x, int32 n);
165
174SPHINXBASE_EXPORT
175void outerproduct(float32 **out_a, float32 *x, float32 *y, int32 len);
176
184SPHINXBASE_EXPORT
185void matrixmultiply(float32 **out_c, /* = */
186 float32 **a, /* * */ float32 **b,
187 int32 n);
188
195SPHINXBASE_EXPORT
196void scalarmultiply(float32 **inout_a, float32 x, int32 n);
197
204SPHINXBASE_EXPORT
205void matrixadd(float32 **inout_a, float32 **b, int32 n);
206
207#if 0
208{ /* Fool indent. */
209#endif
210#ifdef __cplusplus
211}
212#endif
213
214#endif /* MATRIX_H */
SPHINXBASE_EXPORT float64 determinant(float32 **a, int32 len)
Calculate the determinant of a positive definite matrix.
Definition matrix.c:147
SPHINXBASE_EXPORT void floor_nz_1d(float32 *v, uint32 d1, float32 floor)
Floor 1-d array.
Definition matrix.c:114
SPHINXBASE_EXPORT int32 solve(float32 **a, float32 *b, float32 *out_x, int32 n)
Solve (if possible) a positive-definite system of linear equations AX=B for X.
Definition matrix.c:159
SPHINXBASE_EXPORT void matrixadd(float32 **inout_a, float32 **b, int32 n)
Add A += B.
Definition matrix.c:309
SPHINXBASE_EXPORT void floor_nz_3d(float32 ***m, uint32 d1, uint32 d2, uint32 d3, float32 floor)
Floor 3-d array.
Definition matrix.c:96
SPHINXBASE_EXPORT void band_nz_1d(float32 *v, uint32 d1, float32 band)
Ensures that non-zero values x such that -band < x < band, band > 0 are set to -band if x < 0 and ban...
Definition matrix.c:127
SPHINXBASE_EXPORT int32 invert(float32 **out_ainv, float32 **a, int32 len)
Invert (if possible) a positive definite matrix with QR algorithm.
Definition matrix.c:153
SPHINXBASE_EXPORT void outerproduct(float32 **out_a, float32 *x, float32 *y, int32 len)
Calculate the outer product of two vectors.
Definition matrix.c:281
SPHINXBASE_EXPORT void accum_3d(float32 ***out, float32 ***in, uint32 d1, uint32 d2, uint32 d3)
Floor 3-d array.
Definition matrix.c:78
SPHINXBASE_EXPORT void matrixmultiply(float32 **out_c, float32 **a, float32 **b, int32 n)
Multiply C=AB where A and B are symmetric matrices.
Definition matrix.c:166
SPHINXBASE_EXPORT void scalarmultiply(float32 **inout_a, float32 x, int32 n)
Multiply a symmetric matrix by a constant in-place.
Definition matrix.c:295
SPHINXBASE_EXPORT void norm_3d(float32 ***arr, uint32 d1, uint32 d2, uint32 d3)
Norm an array.
Definition matrix.c:50
Basic type definitions used in Sphinx.