21 ((TLhsMatrix::kRows == 3 and TLhsMatrix::kCols == 1) or
22 (TLhsMatrix::kRows == 1 and TLhsMatrix::kCols == 3)) and
23 ((TRhsMatrix::kRows == 3 and TRhsMatrix::kCols == 1) or
24 (TRhsMatrix::kRows == 1 and TRhsMatrix::kCols == 3)),
25 "Cross product only valid for 3x1 or 1x3 matrices");
27 using LhsNestedType = TLhsMatrix;
28 using RhsNestedType = TRhsMatrix;
30 using ScalarType = LhsNestedType::ScalarType;
31 using SelfType = CrossProduct<LhsNestedType, RhsNestedType>;
33 static auto constexpr kRows = 3;
34 static auto constexpr kCols = 1;
35 static bool constexpr bRowMajor =
false;
37 PBAT_HOST_DEVICE CrossProduct(LhsNestedType
const& _A, RhsNestedType
const& _B) : A(_A), B(_B)
41 PBAT_HOST_DEVICE ScalarType operator()(
auto i,
auto j)
const
45 return A(j, 0) * B(i, 0) - A(i, 0) * B(j, 0);
49 PBAT_HOST_DEVICE ScalarType operator()(
auto i)
const {
return (*
this)(i, 0); }
50 PBAT_HOST_DEVICE ScalarType operator[](
auto i)
const {
return (*
this)(i); }
52 PBAT_MINI_READ_API(SelfType)
55 LhsNestedType
const& A;
56 RhsNestedType
const& B;