mirror of
https://github.com/rumata-ap/MatrixExtension_SMathStudio.git
synced 2026-01-12 03:49:47 +03:00
edit
This commit is contained in:
@@ -73,6 +73,29 @@ namespace MatrixExtensions
|
|||||||
"Добавление нового значения ('аргумент') в конец вектора ('вектор').",
|
"Добавление нового значения ('аргумент') в конец вектора ('вектор').",
|
||||||
FunctionSections.MatricesAndVectors, true,
|
FunctionSections.MatricesAndVectors, true,
|
||||||
new ArgumentInfo(ArgumentSections.ColumnVector), new ArgumentInfo(ArgumentSections.Default)),
|
new ArgumentInfo(ArgumentSections.ColumnVector), new ArgumentInfo(ArgumentSections.Default)),
|
||||||
|
|
||||||
|
new TermInfo("listInsertAt", TermType.Function,
|
||||||
|
"Добавление нового значения ('аргумент') в вектор ('вектор') по указанному индексу ('число').",
|
||||||
|
FunctionSections.MatricesAndVectors, true,
|
||||||
|
new ArgumentInfo(ArgumentSections.ColumnVector), new ArgumentInfo(ArgumentSections.Default),
|
||||||
|
new ArgumentInfo(ArgumentSections.RealNumber)),
|
||||||
|
|
||||||
|
new TermInfo("listInsertRange", TermType.Function,
|
||||||
|
"Добавление нового диапазона значений ('2:вектор') в вектор ('1:вектор') по указанному индексу ('число').",
|
||||||
|
FunctionSections.MatricesAndVectors, true,
|
||||||
|
new ArgumentInfo(ArgumentSections.ColumnVector), new ArgumentInfo(ArgumentSections.ColumnVector),
|
||||||
|
new ArgumentInfo(ArgumentSections.RealNumber)),
|
||||||
|
|
||||||
|
new TermInfo("listRemoveAt", TermType.Function,
|
||||||
|
"Удаление элемента вектора ('вектор') по указанному индексу ('число').",
|
||||||
|
FunctionSections.MatricesAndVectors, true,
|
||||||
|
new ArgumentInfo(ArgumentSections.ColumnVector), new ArgumentInfo(ArgumentSections.RealNumber)),
|
||||||
|
|
||||||
|
new TermInfo("listRemoveRange", TermType.Function,
|
||||||
|
"Удаление диапазона элементов вектора ('1:вектор') по указанному индексу начала ('2:число') и количеству ('3:число') значений удаляемого диапазона.",
|
||||||
|
FunctionSections.MatricesAndVectors, true,
|
||||||
|
new ArgumentInfo(ArgumentSections.ColumnVector), new ArgumentInfo(ArgumentSections.RealNumber),
|
||||||
|
new ArgumentInfo(ArgumentSections.RealNumber)),
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -161,17 +184,25 @@ namespace MatrixExtensions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//listSort
|
//listSortAsText
|
||||||
if (value.Type == TermType.Function && value.ArgsCount == 1 && value.Text == "listSortAsText")
|
if (value.Type == TermType.Function && value.ArgsCount == 1 && value.Text == "listSortAsText")
|
||||||
{
|
{
|
||||||
Entry arg1 = Computation.Preprocessing(value.Items[0], context);
|
Entry arg1 = Computation.Preprocessing(value.Items[0], context);
|
||||||
|
|
||||||
TNumber tmp = Computation.NumericCalculation(arg1, context);
|
TNumber tmp = Computation.NumericCalculation(arg1, context);
|
||||||
|
|
||||||
|
BaseEntry be = tmp.obj;
|
||||||
|
Term[] res = be.ToTerms(16, 16, FractionsType.Decimal, true);
|
||||||
|
|
||||||
|
tmp = Computation.NumericCalculation(Entry.Create(res), 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);
|
if (be.Type == BaseEntryType.Matrix)
|
||||||
vector.RemoveAt(vector.Count - 1);
|
{
|
||||||
vector.Sort();
|
vector.RemoveAt(vector.Count - 1);
|
||||||
|
vector.RemoveAt(vector.Count - 1);
|
||||||
|
vector.Sort();
|
||||||
|
}
|
||||||
|
|
||||||
List<Term> answer = new List<Term>();
|
List<Term> answer = new List<Term>();
|
||||||
foreach (string item in vector)
|
foreach (string item in vector)
|
||||||
@@ -293,10 +324,80 @@ namespace MatrixExtensions
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value.Type == TermType.Function && value.ArgsCount == 2 && value.Text == "listRemoveAt")
|
||||||
|
{
|
||||||
|
Entry arg1 = Computation.Preprocessing(value.Items[0], context);
|
||||||
|
Entry arg2 = Computation.Preprocessing(value.Items[1], context);
|
||||||
|
|
||||||
|
TNumber tmp1 = Computation.NumericCalculation(arg1, context);
|
||||||
|
TNumber tmp2 = Computation.NumericCalculation(arg2, context);
|
||||||
|
|
||||||
|
BaseEntry be1 = tmp1.obj;
|
||||||
|
BaseEntry be2 = tmp2.obj;
|
||||||
|
|
||||||
|
List<string> vector = new List<string>(Utilites.EntryMatrix2ArrStr(be1));
|
||||||
|
if (be1.Type == BaseEntryType.Matrix)
|
||||||
|
{
|
||||||
|
vector.RemoveAt(vector.Count - 1);
|
||||||
|
vector.RemoveAt(vector.Count - 1);
|
||||||
|
vector.RemoveAt((int)be2.ToDouble() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Term> answer = new List<Term>();
|
||||||
|
foreach (string item in vector)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(vector.Count.ToString()));
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(1.ToString()));
|
||||||
|
answer.Add(new Term(Functions.Mat, TermType.Function, 2 + vector.Count));
|
||||||
|
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value.Type == TermType.Function && value.ArgsCount == 3 && value.Text == "listRemoveRange")
|
||||||
|
{
|
||||||
|
Entry arg1 = Computation.Preprocessing(value.Items[0], context);
|
||||||
|
Entry arg2 = Computation.Preprocessing(value.Items[1], context);
|
||||||
|
Entry arg3 = Computation.Preprocessing(value.Items[2], context);
|
||||||
|
|
||||||
|
TNumber tmp1 = Computation.NumericCalculation(arg1, context);
|
||||||
|
TNumber tmp2 = Computation.NumericCalculation(arg2, context);
|
||||||
|
TNumber tmp3 = Computation.NumericCalculation(arg3, context);
|
||||||
|
|
||||||
|
BaseEntry be1 = tmp1.obj;
|
||||||
|
BaseEntry be2 = tmp2.obj;
|
||||||
|
BaseEntry be3 = tmp3.obj;
|
||||||
|
|
||||||
|
List<string> vector = new List<string>(Utilites.EntryMatrix2ArrStr(be1));
|
||||||
|
if (be1.Type == BaseEntryType.Matrix)
|
||||||
|
{
|
||||||
|
vector.RemoveAt(vector.Count - 1);
|
||||||
|
vector.RemoveAt(vector.Count - 1);
|
||||||
|
vector.RemoveRange((int)be2.ToDouble() - 1, (int)be3.ToDouble());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Term> answer = new List<Term>();
|
||||||
|
foreach (string item in vector)
|
||||||
|
{
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(vector.Count.ToString()));
|
||||||
|
answer.AddRange(TermsConverter.ToTerms(1.ToString()));
|
||||||
|
answer.Add(new Term(Functions.Mat, TermType.Function, 2 + vector.Count));
|
||||||
|
|
||||||
|
result = Entry.Create(answer.ToArray());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
result = null;
|
result = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user