Example #1
0
        internal static IntrinsicNumericTypeSymbol GetNumericTypeWithScalarType(this IntrinsicNumericTypeSymbol type, ScalarType scalarType)
        {
            switch (type.Kind)
            {
            case SymbolKind.IntrinsicMatrixType:
                var matrixType = (IntrinsicMatrixTypeSymbol)type;
                return(IntrinsicTypes.GetMatrixType(scalarType, matrixType.Rows, matrixType.Cols));

            case SymbolKind.IntrinsicScalarType:
                return(IntrinsicTypes.GetScalarType(scalarType));

            case SymbolKind.IntrinsicVectorType:
                return(IntrinsicTypes.GetVectorType(scalarType, ((IntrinsicVectorTypeSymbol)type).NumComponents));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #2
0
        internal static int GetDimensionSize(this IntrinsicNumericTypeSymbol type, int dimension)
        {
            switch (type.Kind)
            {
            case SymbolKind.IntrinsicMatrixType:
                var matrixType = (IntrinsicMatrixTypeSymbol)type;
                return(dimension == 0 ? matrixType.Rows : matrixType.Cols);

            case SymbolKind.IntrinsicVectorType:
                var vectorType = (IntrinsicVectorTypeSymbol)type;
                return(dimension == 0 ? vectorType.NumComponents : 1);

            case SymbolKind.IntrinsicScalarType:
                return(1);

            default:
                throw new InvalidOperationException();
            }
        }
Example #3
0
 protected bool Equals(IntrinsicNumericTypeSymbol other)
 {
     return(base.Equals(other) && ScalarType == other.ScalarType);
 }