本文整理汇总了C#中BigDecimal.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# BigDecimal.GetLength方法的具体用法?C# BigDecimal.GetLength怎么用?C# BigDecimal.GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BigDecimal
的用法示例。
在下文中一共展示了BigDecimal.GetLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MultiRegBeta
public static BigDecimal[,] MultiRegBeta(BigDecimal[,] x, BigDecimal[,] y)
{ //返回多元回归参数估计值**************************************注意:x第一列为1*******************
int len11 = x.GetLength(0);//行数
int len12 = x.GetLength(1);//列数
BigDecimal[,] b1 = MathV.MatTrans(x);
BigDecimal[,] b2 = MathV.MatTimes(b1, x);
BigDecimal[,] b3 = MathV.MatInv(b2, len12);
BigDecimal[,] b4 = MathV.MatTimes(b3, b1);
BigDecimal[,] bhat = MathV.MatTimes(b4, y);
return bhat;
}
示例2: MatTimes
public static BigDecimal[,] MatTimes(BigDecimal[,] mat1, BigDecimal[,] mat2)
{ //矩阵乘法
int len11 = mat1.GetLength(0);
int len12 = mat1.GetLength(1);
int len21 = mat2.GetLength(0);
int len22 = mat2.GetLength(1);
if (len12 == len21)
{
BigDecimal[,] a = new BigDecimal[len11, len22];
//首先对数组进行初始化
for (int i = 0; i < len11; i++)
{
for (int j = 0; j < len22; j++)
a[i, j] = 0;
}
for (int i = 0; i < len11; i++)
{
for (int j = 0; j < len22; j++)
{
for (int u = 0; u < len12; u++)
{
a[i, j] += mat1[i, u] * mat2[u, j];
}
}
}
return a;
}
else
{
return null;
}
}
示例3: MatTrans
public static BigDecimal[,] MatTrans(BigDecimal[,] mat)
{
//矩阵转置
int len1 = mat.GetLength(0);
int len2 = mat.GetLength(1);
BigDecimal[,] a = new BigDecimal[len2, len1];
for (int i = 0; i < len1; i++)
{
for (int j = 0; j < len2; j++)
{
a[j, i] = mat[i, j];
}
}
return a;
}
示例4: MatMinu
public static BigDecimal[,] MatMinu(BigDecimal[,] mat1, BigDecimal[,] mat2)
{//矩阵减法
int len11 = mat1.GetLength(0);
int len12 = mat1.GetLength(1);
int len21 = mat2.GetLength(0);
int len22 = mat2.GetLength(1);
if (len11 == len21 && len12 == len22)
{
BigDecimal[,] a = new BigDecimal[len11, len12];
for (int i = 0; i < len11; i++)
{
for (int j = 0; j < len12; j++)
{
a[i, j] = mat1[i, j] - mat2[i, j];
}
}
return a;
}
else
{
return null;
}
}