matrix.h
Go to the documentation of this file.
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* ====================================================================
* Copyright (c) 1997-2000 Carnegie Mellon University. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* This work was supported in part by funding from the Defense Advanced
* Research Projects Agency and the National Science Foundation of the
* United States of America, and the CMU Sphinx Speech Consortium.
*
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
* NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ====================================================================
*
*/
/*********************************************************************
*
* File: matrix.h
*
* Description: Matrix and linear algebra functions
*
* Author:
*
*********************************************************************/
#ifndef MATRIX_H
#define MATRIX_H
#ifdef __cplusplus
extern "C" {
#endif
#if 0
/* Fool Emacs. */
}
#endif
/* Win32/WinCE DLL gunk */
#include <sphinxbase/sphinxbase_export.h>
#include <sphinxbase/prim_type.h>
SPHINXBASE_EXPORT void norm_3d(float32 ***arr, uint32 d1, uint32 d2, uint32 d3);
SPHINXBASE_EXPORT void
accum_3d(float32 ***out, float32 ***in, uint32 d1, uint32 d2, uint32 d3);
SPHINXBASE_EXPORT void band_nz_1d(float32 *v, uint32 d1, float32 band);
SPHINXBASE_EXPORT void floor_nz_3d(float32 ***m, uint32 d1, uint32 d2, uint32 d3, float32 floor);
SPHINXBASE_EXPORT void floor_nz_1d(float32 *v, uint32 d1, float32 floor);
SPHINXBASE_EXPORT
float64 determinant(float32 **a, int32 len);
SPHINXBASE_EXPORT
int32 invert(float32 **out_ainv, float32 **a, int32 len);
SPHINXBASE_EXPORT
int32 solve(float32 **a, float32 *b,
float32 *out_x, int32 n);
SPHINXBASE_EXPORT
void outerproduct(float32 **out_a, float32 *x, float32 *y, int32 len);
SPHINXBASE_EXPORT
void matrixmultiply(float32 **out_c, /* = */
float32 **a, /* * */ float32 **b,
int32 n);
SPHINXBASE_EXPORT
void scalarmultiply(float32 **inout_a, float32 x, int32 n);
SPHINXBASE_EXPORT
void matrixadd(float32 **inout_a, float32 **b, int32 n);
#if 0
{ /* Fool indent. */
#endif
#ifdef __cplusplus
}
#endif
#endif /* MATRIX_H */
determinant
SPHINXBASE_EXPORT float64 determinant(float32 **a, int32 len)
Calculate the determinant of a positive definite matrix.
Definition matrix.c:147
floor_nz_1d
SPHINXBASE_EXPORT void floor_nz_1d(float32 *v, uint32 d1, float32 floor)
Floor 1-d array.
Definition matrix.c:114
solve
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
matrixadd
SPHINXBASE_EXPORT void matrixadd(float32 **inout_a, float32 **b, int32 n)
Add A += B.
Definition matrix.c:309
floor_nz_3d
SPHINXBASE_EXPORT void floor_nz_3d(float32 ***m, uint32 d1, uint32 d2, uint32 d3, float32 floor)
Floor 3-d array.
Definition matrix.c:96
band_nz_1d
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
invert
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
outerproduct
SPHINXBASE_EXPORT void outerproduct(float32 **out_a, float32 *x, float32 *y, int32 len)
Calculate the outer product of two vectors.
Definition matrix.c:281
accum_3d
SPHINXBASE_EXPORT void accum_3d(float32 ***out, float32 ***in, uint32 d1, uint32 d2, uint32 d3)
Floor 3-d array.
Definition matrix.c:78
matrixmultiply
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
scalarmultiply
SPHINXBASE_EXPORT void scalarmultiply(float32 **inout_a, float32 x, int32 n)
Multiply a symmetric matrix by a constant in-place.
Definition matrix.c:295
norm_3d
SPHINXBASE_EXPORT void norm_3d(float32 ***arr, uint32 d1, uint32 d2, uint32 d3)
Norm an array.
Definition matrix.c:50
prim_type.h
Basic type definitions used in Sphinx.