Sieve vs filter? Are they opposites?
To keep only those elements which match a predicate, you'd normally say "select" ("Give me the positive integers, and I will select the primes").
Both "filter" and "sieve", as verbs, refer to the act (of separating wheat from chaff), not the result. When these words are used to describe or characterize results, they both can and have been applied to the parts kept (the wheat), and the parts discarded (the chaff).
If you specifically say "filter out", you are describing the elements you removed (discarded); if you say "filter for", you are describing the elements you retained (kept).
Note that I personally have not encountered "sieve" as a verb, only as a noun, and I would not say "sieve the primes". If I wanted to use "sieve" verbally, I would say "sift", as in "sift the integers for primes" (AmE, American Northeast).
I agree with previous answers and comments that suggest the verbs filter and sieve refer to the act of separating, rather than to what is kept or discarded; but when an adverbial out or in follows, that no longer holds.
In my experience, the two verbs are distinguished by mode of application, with filtering applied to keeping or changing objects that satisfy or dissatisfy a predicate, as those objects are streamed through the predicate in a single pass, while sieving designates a process that in multiple passes over a data set winnows out objects that don't satisfy some pass-dependent predicate.