/// <summary> /// Compressed Value Storage (CVS) performs a basic lossless compression such that the /// distinct entry values are aligned with their respective collection of linear indexes. /// </summary> /// <typeparam name="K">The type of keys.</typeparam> /// <typeparam name="T">The type of entry values.</typeparam> /// <param name="sparseMatrix">The sparse matrix to compress.</param> /// <param name="linearIndexMode">The MatrixLinearIndexMode to apply to the coordinates.</param> /// <returns>The compressed value storage (CVS) representation of the sparse matrix.</returns> public static CVS <T> ToCVS <K, T>(this DOKSparseMatrixBase <K, T> sparseMatrix, MatrixLinearIndexMode linearIndexMode = MatrixLinearIndexMode.RowMajorOrder) { CVS <T> cvs = new CVS <T>(linearIndexMode, sparseMatrix.Size); cvs.Compress(sparseMatrix); return(cvs); }
private void Connect() { try { basePath = IniUtils.GetConfig("Credentials", "Base"); string cvsType = IniUtils.GetConfig("CVS", "CVSType"); if (String.IsNullOrWhiteSpace(cvsType)) { throw new ArgumentException("В настройках задайте тип системы контроля версий"); } if (String.IsNullOrWhiteSpace(basePath)) { throw new ArgumentException("В настройках задайте правильный путь до " + cvsType); } cvs = Activator.CreateInstance("CVSLib", "CVSLib.CVSTypes." + IniUtils.GetConfig("CVS", "CVSType")).Unwrap() as CVS; cvs.location = basePath; cvs.login = Environment.UserName; cvs.Connect(); //cvs = new VSS(basePath, Environment.UserName); } catch (COMException exc) { string message = VSSErrors.GetMessageByCode(exc.ErrorCode); MessageBox.Show(message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (ArgumentException exc) { MessageBox.Show(exc.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Stop); } catch (Exception exc) { MessageBox.Show(exc.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }