52 template<
typename dtype>
67 if (arraySize != inArray2.
size() || arraySize < 2 || arraySize > 3)
79 NdArray<dtype> returnArray = { in1[0] * in2[1] - in1[1] * in2[0] };
84 dtype i = in1[1] * in2[2] - in1[2] * in2[1];
85 dtype
j = -(in1[0] * in2[2] - in1[2] * in2[0]);
86 dtype k = in1[0] * in2[1] - in1[1] * in2[0];
101 if (arrayShape != inArray2.
shape() || arrayShape.
rows < 2 || arrayShape.
rows > 3)
106 Shape returnArrayShape;
107 returnArrayShape.
cols = arrayShape.
cols;
108 if (arrayShape.
rows == 2)
110 returnArrayShape.
rows = 1;
114 returnArrayShape.
rows = 3;
118 for (
uint32 col = 0; col < arrayShape.
cols; ++col)
120 const auto theCol =
static_cast<int32>(col);
125 returnArray.
put({ 0,
static_cast<int32>(returnArrayShape.
rows) }, { theCol, theCol + 1 }, vecCross);
133 if (arrayShape != inArray2.
shape() || arrayShape.
cols < 2 || arrayShape.
cols > 3)
138 Shape returnArrayShape;
139 returnArrayShape.
rows = arrayShape.
rows;
140 if (arrayShape.
cols == 2)
142 returnArrayShape.
cols = 1;
146 returnArrayShape.
cols = 3;
150 for (
uint32 row = 0; row < arrayShape.
rows; ++row)
152 const auto theRow =
static_cast<int32>(row);
157 returnArray.
put({ theRow, theRow + 1 }, { 0,
static_cast<int32>(returnArrayShape.
cols) }, vecCross);
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:36
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition: StaticAsserts.hpp:50
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
NdArray< dtype > & put(int32 inIndex, value_type inValue)
Definition: NdArrayCore.hpp:3856
size_type size() const noexcept
Definition: NdArrayCore.hpp:4497
NdArray< dtype > flatten() const
Definition: NdArrayCore.hpp:2919
Slice cSlice(int32 inStartIdx=0, uint32 inStepSize=1) const noexcept
Definition: NdArrayCore.hpp:998
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4483
Slice rSlice(int32 inStartIdx=0, uint32 inStepSize=1) const noexcept
Definition: NdArrayCore.hpp:1013
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
uint32 rows
Definition: Core/Shape.hpp:44
uint32 cols
Definition: Core/Shape.hpp:45
constexpr auto j
Definition: Constants.hpp:45
Definition: Coordinate.hpp:45
NdArray< dtype > cross(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2, Axis inAxis=Axis::NONE)
Definition: cross.hpp:53
Axis
Enum To describe an axis.
Definition: Types.hpp:46
std::int32_t int32
Definition: Types.hpp:36
std::uint32_t uint32
Definition: Types.hpp:40