First omp
This commit is contained in:
@@ -66,9 +66,10 @@
|
||||
namespace panic{
|
||||
namespace tensor{
|
||||
|
||||
template <typename T>
|
||||
struct vector{
|
||||
panic::uint_t length;
|
||||
panic::real_t* data;
|
||||
T* data;
|
||||
|
||||
// empty contructor
|
||||
vector();
|
||||
@@ -77,7 +78,7 @@ struct vector{
|
||||
vector(panic::uint_t size);
|
||||
|
||||
// contructor with size allocation and sets it all to a value
|
||||
vector(panic::uint_t size, panic::real_t value);
|
||||
vector(panic::uint_t size, T value);
|
||||
|
||||
// copy-contructor
|
||||
// vector a(3);
|
||||
@@ -101,22 +102,40 @@ struct vector{
|
||||
bool resize(panic::uint_t new_size);
|
||||
|
||||
// fill data with value
|
||||
bool fill(panic::real_t value);
|
||||
bool fill(T value);
|
||||
|
||||
// lets you read and write v[index]
|
||||
panic::real_t& operator[](panic::uint_t index);
|
||||
T& operator[](panic::uint_t index);
|
||||
|
||||
// lets you read v[index] from a const vector
|
||||
const panic::real_t& operator[](panic::uint_t index) const;
|
||||
const T& operator[](panic::uint_t index) const;
|
||||
|
||||
// lets you read and write v.at(index)
|
||||
panic::real_t& at(panic::uint_t index);
|
||||
T& at(panic::uint_t index);
|
||||
|
||||
// lets you read v.at(index) from a const vector
|
||||
const panic::real_t& at(panic::uint_t index) const;
|
||||
const T& at(panic::uint_t index) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// TYPE ALIASES
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
typedef vector<panic::real_t> real_vector;
|
||||
typedef vector<panic::int_t> int_vector;
|
||||
typedef vector<panic::uint_t> uint_vector;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
// EXPLICIT TEMPLATE DECLARATION
|
||||
//---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
extern template struct vector<panic::real_t>;
|
||||
extern template struct vector<panic::int_t>;
|
||||
extern template struct vector<panic::uint_t>;
|
||||
|
||||
|
||||
} // namespace tensor
|
||||
} // namespace panic
|
||||
|
||||
|
||||
Reference in New Issue
Block a user