Class VariableArray<TItem, TArray>
One-dimensional jagged variable array.
Implements
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Models
Assembly: Microsoft.ML.Probabilistic.Compiler.dll
Syntax
public class VariableArray<TItem, TArray> : VariableArrayBase<TItem, TArray>, CanGetContainers, IModelExpression<TArray>, SettableTo<Variable<TArray>>, ICloneable, HasItemVariables, IVariableJaggedArray, SettableTo<VariableArray<TItem, TArray>>, IJaggedVariableArray<TItem>, IVariableArray, IVariable, IModelExpression, HasObservedValue where TItem : Variable, ICloneable, SettableTo<TItem>
Type Parameters
Name | Description |
---|---|
TItem | Item type |
TArray | Array type |
Constructors
VariableArray(VariableArray<TItem, TArray>)
Copy constructor.
Declaration
protected VariableArray(VariableArray<TItem, TArray> that)
Parameters
Type | Name | Description |
---|---|---|
VariableArray<TItem, TArray> | that |
Properties
Item[Range]
Get or set elements of the array.
Declaration
public TItem this[Range range] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Range | range | The range used to create the array. |
Property Value
Type | Description |
---|---|
TItem | A derived variable that indexes |
Remarks
When setting the elements of an array, the right hand side must be a fresh variable with no other uses. The right-hand side must be an item variable indexed by exactly the ranges of the array, but possibly in a different order.
Item[Variable<Int32>]
Get a variable element of the array.
Declaration
public TItem this[Variable<int> index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Variable<Int32> | index | A variable which selects the element. |
Property Value
Type | Description |
---|---|
TItem | A derived variable that indexes |
Item[Int32]
Get an element of the array.
Declaration
public TItem this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | An integer in [0,array.Length-1] |
Property Value
Type | Description |
---|---|
TItem | A derived variable that indexes |
Range
Range for the array
Declaration
public Range Range { get; }
Property Value
Type | Description |
---|---|
Range |
Methods
Attrib(ICompilerAttribute)
Inline method for adding an attribute to a random variable. This method returns the random variable object, so that is can be used in an inline expression. e.g. Variable.GaussianFromMeanAndVariance(0,1).Attrib(new MyAttribute());
Declaration
public VariableArray<TItem, TArray> Attrib(ICompilerAttribute attr)
Parameters
Type | Name | Description |
---|---|---|
ICompilerAttribute | attr | The attribute to add |
Returns
Type | Description |
---|---|
VariableArray<TItem, TArray> | The random variable object |
Attrib(QueryType)
Helper to add a query type attribute to this variable.
Declaration
public VariableArray<TItem, TArray> Attrib(QueryType queryType)
Parameters
Type | Name | Description |
---|---|---|
QueryType | queryType | The query type to use to create the attribute |
Returns
Type | Description |
---|---|
VariableArray<TItem, TArray> |
Clone()
Clone the variable array
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
Object |
Overrides
Named(String)
Set the name of the array.
Declaration
public VariableArray<TItem, TArray> Named(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name |
Returns
Type | Description |
---|---|
VariableArray<TItem, TArray> |
|
SetTo(VariableArray<TItem, TArray>)
Set the variable array to the given value. Should only be invoked on arrays created using Variable.Array() where the elements have not yet been filled in.
Declaration
public void SetTo(VariableArray<TItem, TArray> that)
Parameters
Type | Name | Description |
---|---|---|
VariableArray<TItem, TArray> | that | A variable array whose definition will be consumed by |
Remarks
that
must have exactly the same set of ranges as this
.
Explicit Interface Implementations
IJaggedVariableArray<TItem>.Item[IModelExpression]
Sets/Gets element in array given by index expression
Declaration
TItem IJaggedVariableArray<TItem>.this[IModelExpression index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
IModelExpression | index |
Returns
Type | Description |
---|---|
TItem |
IVariableArray.ReplaceRanges(Dictionary<Range, Range>, Dictionary<IModelExpression, IModelExpression>, Boolean)
Declaration
IVariableArray IVariableArray.ReplaceRanges(Dictionary<Range, Range> rangeReplacements, Dictionary<IModelExpression, IModelExpression> expressionReplacements, bool deepCopy)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<Range, Range> | rangeReplacements | |
Dictionary<IModelExpression, IModelExpression> | expressionReplacements | |
Boolean | deepCopy |
Returns
Type | Description |
---|---|
IVariableArray |