working on it ...

## Filters

Sort by

Found 25k snippets matching: where

### Checks whether a number is in the range where we expect the robust arithmetic to work

// Checks whether a number is in the range where we expect the robust arithmetic to work // - exponents between -142 and 201. (According to S. p.3)
```using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// Checks whether a number is in the range where we expect the robust arithmetic to work
// - exponents between -142 and 201. (According to S. p.3)
public static bool IsInRange(this double d)
{
double dabs = Math.Abs(d);
return dabs >= 1e-142 && dabs < 1e202;
}```

### OneHot: Creates a matrix of one-hot vectors, where all values at each row are zero except for the indicated <paramref name="indices"/>, which is set to one.

Creates a matrix of one-hot vectors, where all values at each row are zero except for the indicated , which is set to one. The rows's dimension which will be marked as one. The matrix where the one-hot should be marked. A matrix containing one-hot vectors where only a single position is one and the others are zero.
```/// <summary>
///   Creates a matrix of one-hot vectors, where all values at each row are
///   zero except for the indicated <paramref name="indices"/>, which is set to one.
/// </summary>
///
/// <param name="indices">The rows's dimension which will be marked as one.</param>
/// <param name="result">The matrix where the one-hot should be marked.</param>
///
/// <returns>A matrix containing one-hot vectors where only a single position
/// is one and the others are zero.</returns>
///
#if NET45
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static double[,] OneHot(int[] indices, double[,] result)
{
for (int i = 0; i < indices.Length; i++)
result[i, indices[i]] = 1;
return result;
}```

### Where you can find the logs and temporary stuff from IntelliJ on Windows7

This is the location where the plugins can safely write some stuff
`C:\Users\<your user>\AppData\Local\Temp\<pluginName>`

### KHot: Creates a matrix of k-hot vectors, where all values at each row are zero except for the ones in the positions where <paramref name="mask"/> are true, which are set to one.

Creates a matrix of k-hot vectors, where all values at each row are zero except for the ones in the positions where are true, which are set to one. The data type for the matrix. The boolean mask determining where ones will be placed. A matrix containing one-hot vectors where only a single position is one and the others are
```/// <summary>
///   Creates a matrix of k-hot vectors, where all values at each row are
///   zero except for the ones in the positions where <paramref name="mask"/>
///   are true, which are set to one.
/// </summary>
///
/// <typeparam name="T">The data type for the matrix.</typeparam>
///
///
/// <returns>A matrix containing one-hot vectors where only a single position
///   is one and the others are zero.</returns>
///
#if NET45
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
{
}```

### OneHot: Creates a matrix of one-hot vectors, where all values at each row are zero except for the indicated <paramref name="indices"/>, which is set to one.

Creates a matrix of one-hot vectors, where all values at each row are zero except for the indicated , which is set to one. The data type for the matrix. The rows's dimension which will be marked as one. A matrix containing one-hot vectors where only a single position is one and the others are zero.
```/// <summary>
///   Creates a matrix of one-hot vectors, where all values at each row are
///   zero except for the indicated <paramref name="indices"/>, which is set to one.
/// </summary>
///
/// <typeparam name="T">The data type for the matrix.</typeparam>
///
/// <param name="indices">The rows's dimension which will be marked as one.</param>
///
/// <returns>A matrix containing one-hot vectors where only a single position
/// is one and the others are zero.</returns>
///
#if NET45
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static T[][] OneHot<T>(int[] indices)
{
return OneHot<T>(indices, indices.DistinctCount());
}```

### KHot: Creates a matrix of k-hot vectors, where all values at each row are zero except for the indicated <paramref name="indices"/>, which are set to one.

Creates a matrix of k-hot vectors, where all values at each row are zero except for the indicated , which are set to one. The data type for the matrix. The rows's dimension which will be marked as one. The size (length) of the vectors (columns of the matrix). A matrix containing k-hot vectors where only elements at the indicated
```/// <summary>
///   Creates a matrix of k-hot vectors, where all values at each row are
///   zero except for the indicated <paramref name="indices"/>, which are set to one.
/// </summary>
///
/// <typeparam name="T">The data type for the matrix.</typeparam>
///
/// <param name="indices">The rows's dimension which will be marked as one.</param>
/// <param name="columns">The size (length) of the vectors (columns of the matrix).</param>
///
/// <returns>A matrix containing k-hot vectors where only elements at the indicated
///   <paramref name="indices"/> are set to one and the others are zero.</returns>
///
#if NET45
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static T[][] KHot<T>(int[][] indices, int columns)
{
return KHot<T>(indices, Jagged.Create<T>(indices.Length, columns));
}```

### Centering: Creates a centering matrix of size <c>N x N</c> in the form <c>(I - 1N)</c> where <c>1N</c> is a matrix with all elements equal to <c>1 / N</c>.

Creates a centering matrix of size N x N in the form (I - 1N) where 1N is a matrix with all elements equal to 1 / N.
```/// <summary>
///   Creates a centering matrix of size <c>N x N</c> in the
///   form <c>(I - 1N)</c> where <c>1N</c> is a matrix with
///   all elements equal to <c>1 / N</c>.
/// </summary>
///
public static double[,] Centering(int size)
{
if (size < 0)
{
throw new ArgumentOutOfRangeException("size", size,
"The size of the centering matrix must be a positive integer.");
}

double[,] C = Matrix.Square(size, -1.0 / size);

for (int i = 0; i < size; i++)
C[i, i] = 1.0 - 1.0 / size;

return C;
}```

### OneHot: Creates a matrix of one-hot vectors, where all values at each row are zero except for the ones in the positions where <paramref name="mask"/> are true, which are set to one.

Creates a matrix of one-hot vectors, where all values at each row are zero except for the ones in the positions where are true, which are set to one. The data type for the matrix. The boolean mask determining where ones will be placed. A matrix containing one-hot vectors where only a single position is one and the others ar
```/// <summary>
///   Creates a matrix of one-hot vectors, where all values at each row are
///   zero except for the ones in the positions where <paramref name="mask"/>
///   are true, which are set to one.
/// </summary>
///
/// <typeparam name="T">The data type for the matrix.</typeparam>
///
///
/// <returns>A matrix containing one-hot vectors where only a single position
///   is one and the others are zero.</returns>
///
#if NET45
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
{
}```

### KHot: Creates a matrix of k-hot vectors, where all values at each row are zero except for the indicated <paramref name="indices"/>, which are set to one.

Creates a matrix of k-hot vectors, where all values at each row are zero except for the indicated , which are set to one. The rows's dimension which will be marked as one. The matrix where the one-hot should be marked. A matrix containing k-hot vectors where only elements at the indicated are set to one and the others are zero.
```/// <summary>
///   Creates a matrix of k-hot vectors, where all values at each row are
///   zero except for the indicated <paramref name="indices"/>, which are set to one.
/// </summary>
///
/// <param name="indices">The rows's dimension which will be marked as one.</param>
/// <param name="result">The matrix where the one-hot should be marked.</param>
///
/// <returns>A matrix containing k-hot vectors where only elements at the indicated
///   <paramref name="indices"/> are set to one and the others are zero.</returns>
///
#if NET45
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#endif
public static double[,] KHot(int[][] indices, double[,] result)
{
for (int i = 0; i < indices.Length; i++)
for (int j = 0; j < indices[i].Length; j++)
result[i, indices[i][j]] = 1;
return result;
}```

### Swift Collections: Classes vs. Structs - where to use which?

A small distinction in behavior drives the architectural possibilities at play here: structs are value types and classes are reference types.
```Why you should consider using Structs instead of Classes when writing Swift?

Instances of value types are copied whenever they’re assigned or used as a
function argument. Numbers, strings, arrays, dictionaries, enums, tuples, and
structs are value types. For example:

var a = "Hello"
var b = a
b.extend(", world")
println("a: \(a); b: \(b)") // a: Hello; b: Hello, world

Instances of reference types (chiefly: classes, functions) can have multiple
owners. When assigning a reference to a new variable or passing it to a
function, those locations all point to the same instance. This is the behavior
you’re used to with objects. For instance:

var a = UIView()
var b = a
b.alpha = 0.5
println("a: \(a.alpha); b: \(b.alpha)") // a: 0.5; b: 0.5

The distinction between these two categories seems small, but the choice
between values and references can have huge ramifications for your system’s
architecture.

```
• Public Snippets
• Channels Snippets