Flexible magnet