DCP error: product is complex

yes, you are right.

When I wrote this line, the hint was to parenthesize the multiplication of vector h and its transpose. Parenthesizing w and h is the actually correct one. Thank you!