Ferroelectric memory based on nanostructures