static LispReader() { _macros['"'] = new StringReader(); _macros[';'] = new CommentReader(); _macros['\''] = new WrappingReader(QUOTE); _macros['@'] = new WrappingReader(DEREF);//new DerefReader(); _macros['^'] = new WrappingReader(META); _macros['`'] = new SyntaxQuoteReader(); _macros['~'] = new UnquoteReader(); _macros['('] = new ListReader(); _macros[')'] = new UnmatchedDelimiterReader(); _macros['['] = new VectorReader(); _macros[']'] = new UnmatchedDelimiterReader(); _macros['{'] = new MapReader(); _macros['}'] = new UnmatchedDelimiterReader(); //// macros['|'] = new ArgVectorReader(); _macros['\\'] = new CharacterReader(); _macros['%'] = new ArgReader(); _macros['#'] = new DispatchReader(); _dispatchMacros['^'] = new MetaReader(); _dispatchMacros['\''] = new VarReader(); _dispatchMacros['"'] = new RegexReader(); _dispatchMacros['('] = new FnReader(); _dispatchMacros['{'] = new SetReader(); _dispatchMacros['='] = new EvalReader(); _dispatchMacros['!'] = new CommentReader(); _dispatchMacros['<'] = new UnreadableReader(); _dispatchMacros['_'] = new DiscardReader(); }
static void Main(string[] args) { SparseMatrix A = SparseMatrix.Laplacian_1D(10000000); float[] X = VectorReader.GetSplatVector(10000000, 1.0F); int redo = 2; double memoryOperationsSize = (double)redo * (3.0 * (double)(A.data.Length * sizeof(float)) + (double)(2 * A.rows.Length * sizeof(uint)) + (double)(A.indices.Length * sizeof(uint))); Console.WriteLine("matrix read --- starting computations"); float[] B = new float[A.rows.Length - 1]; #region CUDA cudaDeviceProp prop; cuda.GetDeviceProperties(out prop, 0); HybRunner runner = HybRunner.Cuda("SparseMatrix_CUDA.dll").SetDistrib(8 * prop.multiProcessorCount, 256); dynamic wrapper = runner.Wrap(new Program()); for (int i = 0; i < redo; ++i) { wrapper.Multiply(B, A, X, X.Length); } #endregion }
public DistrictSpatialProvider(string level) { _level = level; VectorReader reader = null; switch (level) { case "省": reader = new VectorReader(Path.Combine(_shpDataDir, "Province.shp")); break; case "市": reader = new VectorReader(Path.Combine(_shpDataDir, "City.shp")); break; case "县": reader = new VectorReader(Path.Combine(_shpDataDir, "County.shp")); break; default: break; } _geoObjs = reader.GetAllSpatialAttributeObj(); reader.Dispose(); }
static void Main(string[] args) { const int redo = 30; const int rowsCount = 20000000; SparseMatrix a = SparseMatrix.Laplacian_1D(rowsCount); float[] x = VectorReader.GetSplatVector(a.rows.Length - 1, 1.0F); float[] b = new float[x.Length]; float alpha = 1.0f; float beta = 0.0f; cusparseHandle_t handle; CUSPARSE_64_80.cusparseCreate(out handle); cusparseOperation_t transA = cusparseOperation_t.CUSPARSE_OPERATION_NON_TRANSPOSE; cusparseMatDescr_t descrA; CUSPARSE_64_80.cusparseCreateMatDescr(out descrA); CUSPARSE_64_80.cusparseSetMatType(descrA, cusparseMatrixType_t.CUSPARSE_MATRIX_TYPE_GENERAL); CUSPARSE_64_80.cusparseSetMatIndexBase(descrA, cusparseIndexBase_t.CUSPARSE_INDEX_BASE_ZERO); for (int i = 0; i < redo; ++i) { Multiply(handle, transA, a.rows.Length - 1, x.Length, a.data.Length, alpha, descrA, a.data, a.rows, a.indices, x, beta, b); } CUSPARSE_64_80.cusparseDestroy(handle); Console.Out.WriteLine("DONE"); }
protected override IColor[] DecodeBlock(IList <byte> block, int position) { var bl = new IColor[8 * 8]; var s = new VectorReader(block, position, Endianness.Big); for (var j = 0; j < 2; ++j) { for (var i = 0; i < 2; ++i) { var subblock = this.DecodeCmprSubblock_(block, position); position += 8; for (var r = 0; r < 4; ++r) { for (var c = 0; c < 4; ++c) { var x = i * 4 + c; var y = j * 4 + r; bl[y * 8 + x] = subblock[r * 4 + c]; } } } } return(bl); }
protected override IColor[] DecodeBlock(IList <byte> block, int position) { var bl = new IColor[8 * 4]; var s = new VectorReader(block, position, Endianness.Big); for (var j = 0; j < 4; ++j) { for (var i = 0; i < 8; ++i) { var intensity = s.ReadU8(); bl[j * 8 + i] = ColorImpl.FromIntensityByte(intensity); } } return(bl); }
protected override IColor[] DecodeBlock(IList <byte> block, int position) { var bl = new IColor[4 * 4]; var s = new VectorReader(block, position, Endianness.Big); for (var j = 0; j < 4; ++j) { for (var i = 0; i < 4; ++i) { var pix = s.ReadU16(); bl[j * 4 + i] = ColorUtil.ParseRgb565(pix); } } return(bl); }
protected override IColor[] DecodeBlock(IList <byte> block, int position) { var bl = new IColor[4 * 4]; var s = new VectorReader(block, position, Endianness.Big); for (var j = 0; j < 4; ++j) { for (var i = 0; i < 4; ++i) { var intensity = s.ReadU8(); var alpha = s.ReadU8(); bl[j * 4 + i] = ColorImpl.FromRgbaBytes(intensity, intensity, intensity, alpha); } } return(bl); }
private IColor[] DecodeCmprSubblock_(IList <byte> block, int position) { var reader = new VectorReader(block, position, Endianness.Big); var palette = this.DecodeCmprPalette_(reader.ReadU16(), reader.ReadU16()); var sb = new IColor[4 * 4]; for (var j = 0; j < 4; ++j) { var indices = reader.ReadU8(); for (var i = 0; i < 4; ++i) { var index = (indices >> (2 * (3 - i))) & 0b11; sb[j * 4 + i] = palette[index]; } } return(sb); }
static EdnReader() { _macros['"'] = new StringReader(); _macros[';'] = new CommentReader(); _macros['^'] = new MetaReader(); _macros['('] = new ListReader(); _macros[')'] = new UnmatchedDelimiterReader(); _macros['['] = new VectorReader(); _macros[']'] = new UnmatchedDelimiterReader(); _macros['{'] = new MapReader(); _macros['}'] = new UnmatchedDelimiterReader(); _macros['\\'] = new CharacterReader(); _macros['#'] = new DispatchReader(); _dispatchMacros['^'] = new MetaReader(); //_dispatchMacros['"'] = new RegexReader(); _dispatchMacros['{'] = new SetReader(); _dispatchMacros['<'] = new UnreadableReader(); _dispatchMacros['_'] = new DiscardReader(); }
protected override IColor[] DecodeBlock(IList <byte> block, int position) { var bl = new IColor[8 * 4]; var s = new VectorReader(block, position, Endianness.Big); for (var j = 0; j < 4; ++j) { for (var i = 0; i < 8; ++i) { var pixes = s.ReadU8(); var intensity = ColorUtil.ExtractScaled(pixes, 4, 4, 17); var alpha = ColorUtil.ExtractScaled(pixes, 0, 4, 17); bl[j * 8 + i] = ColorImpl.FromRgbaBytes(intensity, intensity, intensity, alpha); } } return(bl); }
protected override IColor[] DecodeBlock(IList <byte> block, int position) { var bl = new IColor[8 * 8]; var s = new VectorReader(block, position, Endianness.Big); for (var j = 0; j < 8; ++j) { for (var i = 0; i < 4; ++i) { var pixes = s.ReadU8(); var intensity1 = ColorUtil.ExtractScaled(pixes, 4, 4, 17); var intensity2 = ColorUtil.ExtractScaled(pixes, 0, 4, 17); bl[j * 8 + 2 * i] = ColorImpl.FromIntensityByte(intensity1); bl[j * 8 + 2 * i + 1] = ColorImpl.FromIntensityByte(intensity2); } } return(bl); }
protected override IColor[] DecodeBlock(IList <byte> block, int position) { var bl = new IColor[4 * 4]; var s = new VectorReader(block, position, Endianness.Big); for (var j = 0; j < 4; ++j) { for (var i = 0; i < 4; ++i) { var pix = s.ReadU16(); var alphaFlag = BitLogic.ExtractFromRight(pix, 15, 1); byte r, g, b, a; if (alphaFlag == 1) { a = 255; r = ColorUtil.ExtractScaled(pix, 10, 5); g = ColorUtil.ExtractScaled(pix, 5, 5); b = ColorUtil.ExtractScaled(pix, 0, 5); } else { a = ColorUtil.ExtractScaled(pix, 12, 3); r = ColorUtil.ExtractScaled(pix, 8, 4, 17); g = ColorUtil.ExtractScaled(pix, 4, 4, 17); b = ColorUtil.ExtractScaled(pix, 0, 4, 17); } bl[j * 4 + i] = ColorImpl.FromRgbaBytes(r, g, b, a); } } return(bl); }
protected override IColor[] DecodeBlock(IList <byte> block, int position) { var bl = new IColor[Rgba32.BLOCK_WIDTH * Rgba32.BLOCK_HEIGHT]; var s = new VectorReader(block, position, Endianness.Big); var colors = new (byte, byte, byte, byte)[Rgba32.BLOCK_WIDTH *