refactoring

This commit is contained in:
2020-12-25 10:19:04 +03:00
parent 2bb05312eb
commit 9ce42d347d
2 changed files with 14 additions and 5 deletions

View File

@@ -231,8 +231,8 @@ namespace MatrixExtensions
TNumber tmp = Computation.NumericCalculation(arg1, context); TNumber tmp = Computation.NumericCalculation(arg1, context);
List<string> vector = new List<string>(Utilites.EntryMatrix2ArrStr(tmp.obj)); List<string> vector = new List<string>(Utilites.EntryMatrix2ArrStr(tmp.obj));
vector.RemoveAt(vector.Count - 1); //vector.RemoveAt(vector.Count - 1);
vector.RemoveAt(vector.Count - 1); //vector.RemoveAt(vector.Count - 1);
List<string> distinct = vector.Distinct().ToList(); List<string> distinct = vector.Distinct().ToList();
List<Term> answer = new List<Term>(); List<Term> answer = new List<Term>();

View File

@@ -16,9 +16,18 @@ namespace MatrixExtensions
internal static string[] EntryMatrix2ArrStr(BaseEntry matrix) internal static string[] EntryMatrix2ArrStr(BaseEntry matrix)
{ {
string source = matrix.ToString(); TMatrix mt = matrix as TMatrix;
source = source.Trim(new char[] { 'm', 'a', 't', '(', ')' }); //int n = mt.unit.GetLength(0);
return source.Split(','); //int m = mt.unit.GetLength(0);
List<string> mts = new List<string>(mt.Length());
foreach (var item in mt.unit)
{
mts.Add(item.obj.ToString());
}
//string source = matrix.ToString();
//source = source.Trim(new char[] { 'm', 'a', 't', '(', ')' });
//return source.Split(',','\n');
return mts.ToArray();
} }
internal static double[] EntryVec2Arr(Entry vector) internal static double[] EntryVec2Arr(Entry vector)