~ubuntu-branches/ubuntu/raring/sphinxtrain/raring-proposed

« back to all changes in this revision

Viewing changes to include/s3/vector.h

  • Committer: Package Import Robot
  • Author(s): Samuel Thibault
  • Date: 2013-01-02 04:10:21 UTC
  • Revision ID: package-import@ubuntu.com-20130102041021-ynsizmz33fx02hea
Tags: upstream-1.0.8
ImportĀ upstreamĀ versionĀ 1.0.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ====================================================================
 
2
 * Copyright (c) 1995-2000 Carnegie Mellon University.  All rights 
 
3
 * reserved.
 
4
 *
 
5
 * Redistribution and use in source and binary forms, with or without
 
6
 * modification, are permitted provided that the following conditions
 
7
 * are met:
 
8
 *
 
9
 * 1. Redistributions of source code must retain the above copyright
 
10
 *    notice, this list of conditions and the following disclaimer. 
 
11
 *
 
12
 * 2. Redistributions in binary form must reproduce the above copyright
 
13
 *    notice, this list of conditions and the following disclaimer in
 
14
 *    the documentation and/or other materials provided with the
 
15
 *    distribution.
 
16
 *
 
17
 * This work was supported in part by funding from the Defense Advanced 
 
18
 * Research Projects Agency and the National Science Foundation of the 
 
19
 * United States of America, and the CMU Sphinx Speech Consortium.
 
20
 *
 
21
 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 
 
22
 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
 
23
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 
24
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
 
25
 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
26
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
 
27
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
 
28
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
 
29
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 
30
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
 
31
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
32
 *
 
33
 * ====================================================================
 
34
 *
 
35
 */
 
36
 
 
37
#ifndef VECTOR_H
 
38
#define VECTOR_H
 
39
#ifdef __cplusplus
 
40
extern "C" {
 
41
#endif
 
42
#if 0
 
43
}
 
44
#endif
 
45
 
 
46
#include <sphinxbase/prim_type.h>
 
47
 
 
48
typedef float *vector_t;
 
49
 
 
50
vector_t
 
51
vector_alloc(int32 n_dim);
 
52
 
 
53
int
 
54
vector_free(vector_t v);
 
55
 
 
56
void
 
57
vector_floor(vector_t v, uint32 dim, float32 f);
 
58
 
 
59
void
 
60
vector_nz_floor(vector_t v, uint32 dim, float32 f);
 
61
 
 
62
int32
 
63
vector_normalize(vector_t v, uint32 dim);
 
64
 
 
65
float64 vector_sum_norm (float32 *vec, int32 len);
 
66
 
 
67
void
 
68
vector_add(vector_t a, const vector_t b, uint32 dim);
 
69
 
 
70
void
 
71
vector_sub(vector_t a, const vector_t b, uint32 dim);
 
72
 
 
73
void
 
74
vector_scale(vector_t a, float32 b, uint32 dim);
 
75
 
 
76
void
 
77
vector_cross(vector_t a, const vector_t b, uint32 dim);
 
78
 
 
79
float64
 
80
vector_dot(const vector_t a, const vector_t b, uint32 dim);
 
81
/* See matrix.h for outer product. */
 
82
 
 
83
void
 
84
vector_print(vector_t v, uint32 dim);
 
85
 
 
86
#ifdef __cplusplus
 
87
}
 
88
#endif
 
89
#endif /* VECTOR_H */ 
 
90