Hard x-ray polarimeter for gamma-ray bursts and solar flares