Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66742246
Vector.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jun 12, 18:45
Size
1 KB
Mime Type
text/x-c++
Expires
Fri, Jun 14, 18:45 (2 d)
Engine
blob
Format
Raw Data
Handle
18230731
Attached To
R7934 PCSC_project
Vector.hpp
View Options
#ifndef VECTORHEADERDEF
#define VECTORHEADERDEF
#include <string>
class
Vector
{
private
:
double
*
mData
;
// data stored in vector
int
mSize
;
// size of vector
public
:
Vector
(
const
Vector
&
otherVector
);
Vector
(
int
size
);
Vector
();
~
Vector
();
int
GetSize
()
const
;
double
&
operator
[](
int
i
);
// zero-based indexing
// read-only zero-based indexing
double
Read
(
int
i
)
const
;
int
CheckIndex
(
int
i
)
const
;
double
&
operator
()(
int
i
);
// one-based indexing
// assignment
Vector
&
operator
=
(
const
Vector
&
otherVector
);
Vector
operator
+
()
const
;
// unary +
Vector
operator
-
()
const
;
// unary -
Vector
operator
+
(
const
Vector
&
v1
)
const
;
// binary +
Vector
operator
-
(
const
Vector
&
v1
)
const
;
// binary -
Vector
operator
*
(
const
Vector
&
v1
)
const
;
// binary *
Vector
operator
/
(
const
Vector
&
v1
)
const
;
// binary /
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
output
,
const
Vector
&
v
);
// scalar multiplication
Vector
operator
*
(
double
a
)
const
;
// p-norm method
double
CalculateNorm
(
int
p
=
2
)
const
;
// declare length function as a friend
friend
int
length
(
const
Vector
&
v
);
};
// Prototype signature of length() friend function
int
length
(
const
Vector
&
v
);
// Prototype signature of TerminalPrint() friend function
void
TerminalPrint
(
Vector
v
,
std
::
string
msg
)
;
#endif
Event Timeline
Log In to Comment