|
#ifndef Vec1D_h
#define Vec1D_h
/*
arrange -3 -2 -1 0 +1 +2 indeces array
vec1D v(6,-3);
v(-3) = val1;
v(-2) = val2;
...
v[2] = val6
*/
class vec1D //16 bit MMX aligned array
{
public:
vec1D(unsigned int size = 1, int offset = 0, const float* data = 0);
vec1D(const vec1D& v);
~vec1D();
inline int first() const; //return first index into array m_data[0]
inline int last() const; //return last index into array m_data[size-1]
inline unsigned int size() const; //total size of array
inline const float* data() const; //return m_data pointer
inline const float* data(int i) const; //return m_data pointer
inline float& operator()(int x); //operator m_data[x]
inline float operator()(int x) const; //const operator m_data[x] for funcs( const vec1D& v )
inline float& operator[](int x); //operator m_data[x]
inline float operator[](int x) const; //const operator m_data[x] for funcs( const vec1D& v )
inline const vec1D& operator=(const vec1D& v); //operator =
private:
int m_offset;
int m_last;
unsigned int m_size;
float* m_data;
void init(const vec1D& v);
void close();
};
inline int vec1D::first() const
{
return m_offset;
}
inline int vec1D::last() const
{
return m_last;
}
inline unsigned int vec1D::size() const
{
return m_size;
}
inline float& vec1D::operator()(int x)
{
return m_data[x];
}
inline float vec1D::operator()(int x) const
{
return m_data[x];
}
inline float& vec1D::operator[](int x)
{
return m_data[x];
}
inline float vec1D::operator[](int x) const
{
return m_data[x];
}
inline const vec1D& vec1D::operator=(const vec1D& v)
{
if (this != &v)
init(v);
return *this;
}
inline const float* vec1D::data() const
{
return &m_data[first()];
}
inline const float* vec1D::data(int i) const
{
return &m_data[i];
}
#endif
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Highly skilled Engineer with 14 years of experience in academia, R&D and commercial product development supporting full software life-cycle from idea to implementation and further support. During my academic career I was able to succeed in MIT Computers in Cardiology 2006 international challenge, as a R&D and SW engineer gain CodeProject MVP, find algorithmic solutions to quickly resolve tough customer problems to pass product requirements in tight deadlines. My key areas of expertise involve Object-Oriented
Analysis and Design OOAD, OOP, machine learning, natural language processing, face recognition, computer vision and image processing, wavelet analysis, digital signal processing in cardiology.