The cheaper fuel or heater depends on your electricity tariff, pellet price, stove efficiency and the heat pump's effective COP.
Unit cost comparison
For example, electricity at €0.21/kWh and COP 3.5 gives €0.060 per useful kWh. A €4.99 pellet bag with 15 kg, 4.7 kWh/kg and 85% stove efficiency gives approximately €0.0833 per useful kWh.
These are theoretical energy costs, not prices gathered automatically. Distribution, installation and maintenance costs may alter the decision.
When pellets might compare better
With cheaper pellets, more expensive electricity, lower real-world COP or a different heating layout, the comparison can change. A single appliance may not deliver sufficient heat to every room.