Top "Covariance" questions

Covariance, contravariance and invariance describe how the existing type inheritance hierarchy changes when subjected to some transformation (such as usage within generics).

Building a covariance matrix in Python

Problem I want to implement an algorithm from an unpublished paper by my supervisor and as part of that, I …

python numpy scipy covariance gaussian
Generate a data set consisting of N=100 2-dimensional samples

How do I generate a data set consisting of N = 100 2-dimensional samples x = (x1,x2)T ∈ R2 drawn from a 2…

python matrix dataset covariance gaussian
Why covariance and contravariance do not support value type

IEnumerable<T> is co-variant but it does not support value type, just only reference type. The below simple …

c# .net c#-4.0 covariance contravariance
Why are Arrays invariant, but Lists covariant?

E.g. why does val list:List[Any] = List[Int](1,2,3) work, but val arr:Array[Any] = Array[Int](1,2,3) fails (because …

arrays list scala covariance
IDictionary<TKey, TValue> in .NET 4 not covariant

The IDictionary<TKey, TValue> in .NET 4 / Silverlight 4 does not support covariance, i.e. I can't do a IDictionary&…

.net dictionary .net-4.0 covariance
Covariance and IList

I would like a Covariant collection whose items can be retrieved by index. IEnumerable is the only .net collection that …

c# .net .net-4.0 covariance
Getting a vector<Derived*> into a function that expects a vector<Base*>

Consider these classes. class Base { ... }; class Derived : public Base { ... }; this function void BaseFoo( std::vector<Base*>vec ) { ... } And …

c++ stl vector covariance
Why is Scala's immutable Set not covariant in its type?

EDIT: Re-written this question based on original answer The scala.collection.immutable.Set class is not covariant in its type …

scala set covariance scala-collections
Difference between Covariance and Contra-variance in programming languages

Can anyone explain the concept of covariance and contravariance in programming language theory?

java c# programming-languages covariance contravariance