Умножение матрицы на вектор-столбец - C#
Формулировка задачи:
Помогите решить задание, пишет что проблема в res.GetLength(1)
{
class Program
{
static void Main(string[] args)
{
double[,] A = { { 0, 1 }, { 2, 3 } };
double[] B = { 1, 1 };
double[] res = Matrix.Stolb(A, B);
for (int row = 0; row < res.GetLength(0); row++)
{
for (int col = 0; col < res.GetLength(1); col++)
{
Console.Write(res[row] + "\t");
}
Console.WriteLine();
}
Console.ReadLine();
}
}
}
{
class Matrix
{
public static double[] Stolb(double[,] A, double[] B)
{
double[] res = new double[B.GetLength(0)];
for (int row = 0; row < A.GetLength(0); row++)
{
for (int col = 0; col < A.GetLength(1); col++)
{
res[col] += A[row, col] * B[row];
}
}
return res;
}
}
}Решение задачи: «Умножение матрицы на вектор-столбец»
textual
Листинг программы
... double[] res = Matrix.Stolb(A, B); ...