Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
Vector Class Reference

Holds a matrix of doubles and supports arithmetic operations, including Vector-Matrix operations. Used by InterpolateAudio. More...

#include <Matrix.h>

Collaboration diagram for Vector:
[legend]

Public Member Functions

 Vector ()
 
 Vector (const Vector &copyFrom)
 
 Vector (unsigned len, double *data=NULL)
 
 Vector (unsigned len, float *data)
 
Vectoroperator= (const Vector &other)
 
 ~Vector ()
 
void Reinit (unsigned len)
 
void Swap (Vector &that)
 
double & operator[] (unsigned i)
 
double operator[] (unsigned i) const
 
unsigned Len () const
 
double Sum () const
 

Private Attributes

unsigned mN { 0 }
 
Doubles mData
 

Detailed Description

Holds a matrix of doubles and supports arithmetic operations, including Vector-Matrix operations. Used by InterpolateAudio.

Definition at line 33 of file Matrix.h.

Constructor & Destructor Documentation

◆ Vector() [1/4]

Vector::Vector ( )

Definition at line 18 of file Matrix.cpp.

19{
20}

◆ Vector() [2/4]

Vector::Vector ( const Vector copyFrom)

Definition at line 49 of file Matrix.cpp.

50 : mN{ other.Len() }
51 , mData{ mN }
52{
53 std::copy(other.mData.get(), other.mData.get() + mN, mData.get());
54}
Doubles mData
Definition: Matrix.h:54
unsigned mN
Definition: Matrix.h:53
void copy(const T *src, T *dst, int32_t n)
Definition: VectorOps.h:40

References staffpad::vo::copy(), mData, and mN.

Here is the call graph for this function:

◆ Vector() [3/4]

Vector::Vector ( unsigned  len,
double *  data = NULL 
)

Definition at line 22 of file Matrix.cpp.

23 : mN{ len }
24 , mData(len)
25{
26 if (data)
27 std::copy(data, data + len, mData.get());
28 else
29 std::fill(mData.get(), mData.get() + len, 0.0);
30}

References staffpad::vo::copy(), and mData.

Here is the call graph for this function:

◆ Vector() [4/4]

Vector::Vector ( unsigned  len,
float *  data 
)

Definition at line 32 of file Matrix.cpp.

33 : mN{ len }
34 , mData{ len }
35{
36 if (data)
37 std::copy(data, data + len, mData.get());
38 else
39 std::fill(mData.get(), mData.get() + len, 0.0);
40}

References staffpad::vo::copy(), and mData.

Here is the call graph for this function:

◆ ~Vector()

Vector::~Vector ( )

Definition at line 56 of file Matrix.cpp.

57{
58}

Member Function Documentation

◆ Len()

unsigned Vector::Len ( ) const
inline

Definition at line 48 of file Matrix.h.

48{ return mN; }

References mN.

Referenced by operator*(), operator+(), operator-(), operator=(), Sum(), and VectorConcatenate().

Here is the caller graph for this function:

◆ operator=()

Vector & Vector::operator= ( const Vector other)

Definition at line 42 of file Matrix.cpp.

43{
44 wxASSERT(Len() == other.Len());
45 std::copy(other.mData.get(), other.mData.get() + mN, mData.get());
46 return *this;
47}
unsigned Len() const
Definition: Matrix.h:48

References staffpad::vo::copy(), Len(), mData, and mN.

Here is the call graph for this function:

◆ operator[]() [1/2]

double & Vector::operator[] ( unsigned  i)
inline

Definition at line 46 of file Matrix.h.

46{ return mData[i]; }

References mData.

◆ operator[]() [2/2]

double Vector::operator[] ( unsigned  i) const
inline

Definition at line 47 of file Matrix.h.

47{ return mData[i]; }

References mData.

◆ Reinit()

void Vector::Reinit ( unsigned  len)

Definition at line 60 of file Matrix.cpp.

61{
62 Vector temp(len);
63 Swap(temp);
64}
Holds a matrix of doubles and supports arithmetic operations, including Vector-Matrix operations....
Definition: Matrix.h:34
void Swap(Vector &that)
Definition: Matrix.cpp:66

References Swap().

Here is the call graph for this function:

◆ Sum()

double Vector::Sum ( ) const

Definition at line 72 of file Matrix.cpp.

73{
74 double sum = 0.0;
75 for(unsigned i = 0; i < Len(); i++)
76 sum += mData[i];
77 return sum;
78}

References Len(), and mData.

Here is the call graph for this function:

◆ Swap()

void Vector::Swap ( Vector that)

Definition at line 66 of file Matrix.cpp.

67{
68 std::swap(mN, that.mN);
69 mData.swap(that.mData);
70}
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:634

References mData, mN, and anonymous_namespace{NoteTrack.cpp}::swap().

Referenced by Reinit().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mData

Doubles Vector::mData
private

Definition at line 54 of file Matrix.h.

Referenced by operator=(), operator[](), Sum(), Swap(), and Vector().

◆ mN

unsigned Vector::mN { 0 }
private

Definition at line 53 of file Matrix.h.

Referenced by Len(), operator=(), Swap(), and Vector().


The documentation for this class was generated from the following files: