乗算代入

Namespace: FVIL.Data
Assembly: FVILbasic (in FVILbasic.dll) Version: 3.1.0.0 (3.1.0.17)

Syntax

C#
public virtual CFviMatrix Mul(
	CFviMatrix src
)
Visual Basic
Public Overridable Function Mul ( 
	src As CFviMatrix
) As CFviMatrix

Parameters

src
Type: FVIL.Data..::..CFviMatrix
乗算する行列

Return Value

Type: CFviMatrix
演算後の自身のインスタンスを返します。

Remarks

引数に指定された行列を現在の行列に乗算して返します。現在の行列を更新します。 このメソッドは MultiplicationAssignment(CFviMatrix, CFviMatrix) オペレータと等価です。

処理に失敗した場合は例外を発行します。 例外の原因と発生位置を特定するには、発行された例外クラスの ErrorCode メンバと Function メンバを参照してください。

エラーコード:

ErrorCode メンバ内容
51FVIL.ErrorCode.LICENSE_ERRORライセンスがありません。
1FVIL.ErrorCode.FAILED_TO_ALLOCATEメモリの確保に失敗しました。
11FVIL.ErrorCode.INVALID_PARAMETERパラメータが不正です。
12FVIL.ErrorCode.INVALID_OBJECTメモリが確保されていません。
29FVIL.ErrorCode.NOT_CALCULABLE計算できません。

Examples

ソースコード:
C# Copy imageCopy
//    $Revision: 1.2 $

using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;    // FvPluginXXXX attribute requires fvalgcli

namespace User.SampleCode
{
    public partial class Matrix
    {
        /// <summary>
        /// 乗算代入.
        /// </summary> 
        [FvPluginExecute]
        public void Mul()
        {
            int rows = 4;
            int columns = 2;
            // 1) インスタンスの準備.
            FVIL.Data.CFviMatrix mat = new FVIL.Data.CFviMatrix(rows, columns);
            FVIL.Data.CFviMatrix mat2 = new FVIL.Data.CFviMatrix(columns, rows + 1);

            // 2) 行列の要素の設定.
            mat[0, 0] = 1.0; mat[0, 1] = 3.0;
            mat[1, 0] = 4.0; mat[1, 1] = -2.0;
            mat[2, 0] = 2.0; mat[2, 1] = 5.0;
            mat[3, 0] = 3.0; mat[3, 1] = 1.0;

            mat2[0, 0] = 3.0; mat2[0, 1] = 8.0; mat2[0, 2] = 1.0;
            mat2[1, 0] = 0.0; mat2[1, 1] = -2.0; mat2[1, 2] = 5.0; 

            // 3) 計算実行.
            mat.Mul(mat2);

            // 確認) 処理結果の出力.
            Console.Write("CFviMatrix.Mul\n");
            for (int row = 0; row < mat.Rows; row++)
            {
                for (int column = 0; column < mat.Columns; column++)
                {
                    Console.Write("[{0}][{1}]={2} ", row, column, mat[row, column]);
                }
                Console.Write("\n");
            }
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
' FvPluginXXXX attribute requires fvalgcli
Namespace SampleCode
    Public Partial Class Matrix
        ''' <summary>
        ''' 乗算代入.
        ''' </summary> 
        <FvPluginExecute> _
        Public Sub Mul()
            Dim rows As Integer = 4
            Dim columns As Integer = 2
            ' 1) インスタンスの準備.
            Dim mat As New FVIL.Data.CFviMatrix(rows, columns)
            Dim mat2 As New FVIL.Data.CFviMatrix(columns, rows + 1)

            ' 2) 行列の要素の設定.
            mat(0, 0) = 1.0
            mat(0, 1) = 3.0
            mat(1, 0) = 4.0
            mat(1, 1) = -2.0
            mat(2, 0) = 2.0
            mat(2, 1) = 5.0
            mat(3, 0) = 3.0
            mat(3, 1) = 1.0

            mat2(0, 0) = 3.0
            mat2(0, 1) = 8.0
            mat2(0, 2) = 1.0
            mat2(1, 0) = 0.0
            mat2(1, 1) = -2.0
            mat2(1, 2) = 5.0

            ' 3) 計算実行.
            mat.Mul(mat2)

            ' 確認) 処理結果の出力.
            Console.Write("CFviMatrix.Mul" & vbLf)
            For row As Integer = 0 To mat.Rows - 1
                For column As Integer = 0 To mat.Columns - 1
                    Console.Write("[{0}][{1}]={2} ", row, column, mat(row, column))
                Next
                Console.Write(vbLf)
            Next
        End Sub
    End Class
End Namespace
【関数の出力】
CFviMatrix.Mul
[0][0]=3 [0][1]=2 [0][2]=16 [0][3]=0 [0][4]=0 
[1][0]=12 [1][1]=36 [1][2]=-6 [1][3]=0 [1][4]=0 
[2][0]=6 [2][1]=6 [2][2]=27 [2][3]=0 [2][4]=0 
[3][0]=9 [3][1]=22 [3][2]=8 [3][3]=0 [3][4]=0 
	

Exceptions

ExceptionCondition
FVIL..::..CFviExceptionこの例外の原因については、上記のエラーコード表をご参照ください。

See Also