kwave
18.07.70
Main Page
Related Pages
+
Namespaces
Namespace List
+
Namespace Members
+
All
_
a
b
c
f
h
i
l
m
o
p
r
s
t
u
w
y
z
Functions
Typedefs
Enumerations
+
Enumerator
a
b
c
f
i
l
o
p
r
s
u
w
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
+
Variables
a
b
c
d
e
f
g
h
i
m
n
p
r
s
t
v
w
x
y
z
Typedefs
Enumerations
+
Enumerator
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Related Functions
+
Files
File List
+
File Members
+
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
i
l
m
p
q
r
s
t
x
z
Variables
Typedefs
+
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Matrix.h
Go to the documentation of this file.
1
/***************************************************************************
2
Matrix.h - simple template class for a NxM matrix
3
-------------------
4
begin : Sat May 12 2012
5
copyright : (C) 2012 by Thomas Eschenbacher
6
email : Thomas.Eschenbacher@gmx.de
7
8
based on Matrix.h from Martin Hinsch
9
copyright (C) 2001 by Martin Hinsch <vidas@sourceforge.net>
10
***************************************************************************/
11
12
/***************************************************************************
13
* *
14
* This program is free software; you can redistribute it and/or modify *
15
* it under the terms of the GNU General Public License as published by *
16
* the Free Software Foundation; either version 2 of the License, or *
17
* (at your option) any later version. *
18
* *
19
***************************************************************************/
20
21
#ifndef MATRIX_H
22
#define MATRIX_H
23
24
#include "config.h"
25
26
#include <string.h>
27
28
#include <QtGlobal>
29
30
namespace
Kwave
31
{
32
33
template
<
class
T>
class
Matrix
34
{
35
public
:
36
42
Matrix
(
unsigned
int
cols,
unsigned
int
rows)
43
:
m_rows
(rows),
m_cols
(cols),
m_data
(Q_NULLPTR)
44
{
45
m_data
=
new
T[
m_rows
*
m_cols
];
46
Q_ASSERT(
m_data
);
47
}
48
50
Matrix
(
const
Matrix
&other)
51
:
m_rows
(other.
m_rows
),
m_cols
(other.
m_cols
),
m_data
(Q_NULLPTR)
52
{
53
m_data
=
new
T[
m_rows
*
m_cols
];
54
Q_ASSERT(
m_data
);
55
memcpy(
m_data
, other.
m_data
,
m_rows
*
m_cols
*
sizeof
(T));
56
}
57
59
virtual
~Matrix
()
60
{
61
if
(
m_data
)
delete
[]
m_data
;
62
}
63
65
inline
T *
operator[]
(
unsigned
int
col)
const
{
66
return
m_data
+ (col *
m_rows
);
67
}
68
69
private
:
70
72
unsigned
int
m_rows
;
73
75
unsigned
int
m_cols
;
76
78
T *
m_data
;
79
};
80
}
81
82
#endif
/* MATRIX_H */
83
84
//***************************************************************************
85
//***************************************************************************
Kwave
Definition:
App.h:33
Kwave::Matrix::Matrix
Matrix(const Matrix &other)
Definition:
Matrix.h:50
Kwave::Matrix
Definition:
Matrix.h:33
Kwave::Matrix::m_data
T * m_data
Definition:
Matrix.h:78
Kwave::Matrix::~Matrix
virtual ~Matrix()
Definition:
Matrix.h:59
Kwave::Matrix::m_cols
unsigned int m_cols
Definition:
Matrix.h:75
Kwave::Matrix::Matrix
Matrix(unsigned int cols, unsigned int rows)
Definition:
Matrix.h:42
Kwave::Matrix::m_rows
unsigned int m_rows
Definition:
Matrix.h:72
Kwave::Matrix::operator[]
T * operator[](unsigned int col) const
Definition:
Matrix.h:65
libkwave
Matrix.h
Generated on Sat Mar 24 2018 09:10:25 for kwave by
1.8.13