NumCpp  2.14.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
hat.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <string>
31
34#include "NumCpp/NdArray.hpp"
36
37namespace nc::linalg
38{
39 //============================================================================
40 // Method Description:
48 template<typename dtype>
50 {
52
54 returnArray(0, 0) = 0.;
55 returnArray(0, 1) = -inZ;
56 returnArray(0, 2) = inY;
57 returnArray(1, 0) = inZ;
58 returnArray(1, 1) = 0.;
59 returnArray(1, 2) = -inX;
60 returnArray(2, 0) = -inY;
61 returnArray(2, 1) = inX;
62 returnArray(2, 2) = 0.;
63
64 return returnArray;
65 }
66
67 //============================================================================
68 // Method Description:
74 template<typename dtype>
76 {
78
79 if (inVec.size() != 3)
80 {
81 THROW_INVALID_ARGUMENT_ERROR("input vector must be a length 3 cartesian vector.");
82 }
83
84 return hat(inVec[0], inVec[1], inVec[2]);
85 }
86
87 //============================================================================
88 // Method Description:
95 {
96 return hat(inVec.x, inVec.y, inVec.z);
97 }
98} // namespace nc::linalg
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
Holds a 3D vector.
Definition Vec3.hpp:51
Definition cholesky.hpp:41
NdArray< dtype > hat(dtype inX, dtype inY, dtype inZ)
Definition hat.hpp:49
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59