help on optimization problem

A=S*B*C where known:A:(m*n) matrix and B:(m*n) matrix unknow S:(m*m)diagonal matrix, C (n*n) diagonal matrix The question is how to get matrix S and C, which let |A-S*B*C|^2 be smallest.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
Add image file
Upload is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.