Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.
This repository was archived by the owner on May 6, 2024. It is now read-only.

method HadamardProduct of Matrix can not compile  #47

@DamonsJ

Description

@DamonsJ

static inline Matrix<T, Rows, Cols> HadamardProduct( const Matrix<T, Rows, Cols>& m1, const Matrix<T, Rows, Cols>& m2) {
MATHFU_MAT_OPERATOR(m1[i] * m2[i]);
}

this function can not compile because MATHFU_MAT_OPERATOR expand as :
Matrix<T, Rows, Cols> result;
MATHFU_TOOL_MAT_OPERATION(result.data_[i] = (OP));

where result.data_[i] is a vector and m1[i] * m2[i] is a scalar

this shoud be implemented as below:
static inline Matrix<T, Rows, Cols> HadamardProduct( const Matrix<T, Rows, Cols>& m1, const Matrix<T, Rows, Cols>& m2) {
Matrix<T, Rows, Cols> result;
for (int i = 0; i < kElements;++i) {
result[i] = (m1[i] * m2[i]);
}
return result;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions