ベクトルの設定 (行指定)
Namespace: FVIL.DataAssembly: FVILbasic (in FVILbasic.dll) Version: 3.1.0.0 (3.1.0.17)
Syntax
C# |
---|
public virtual void SetRowVector( int row, CFviVector vector ) |
Visual Basic |
---|
Public Overridable Sub SetRowVector ( row As Integer, vector As CFviVector ) |
Remarks
指定されたベクトルの各要素を指定行の各要素にコピーします。
生成に失敗した場合は例外を発行します。 例外の原因と発生位置を特定するには、発行された例外クラスの ErrorCode メンバと Function メンバを参照してください。
エラーコード:
値 | ErrorCode メンバ | 内容 |
---|---|---|
11 | FVIL.ErrorCode.INVALID_PARAMETER | パラメータが不正です。 |
12 | FVIL.ErrorCode.INVALID_OBJECT | メモリが確保されていません。 |
Examples
ソースコード:
【関数の出力】
C# | Copy |
---|---|
// $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 SetRowVector() { int rows = 3; int columns = 4; // 1) インスタンスの準備. FVIL.Data.CFviMatrix mat = new FVIL.Data.CFviMatrix(rows, columns); FVIL.Data.CFviVector vector = new FVIL.Data.CFviVector(columns); // 2) 行列の要素の設定. mat[0, 0] = 1.0; mat[0, 1] = 5.0; mat[0, 2] = 9.0; mat[0, 3] = 13.0; mat[1, 0] = 2.0; mat[1, 1] = 6.0; mat[1, 2] = 10.0; mat[1, 3] = 14.0; mat[2, 0] = 3.0; mat[2, 1] = 7.0; mat[2, 2] = 11.0; mat[2, 3] = 15.0; vector[0] = 3.0; vector[1] = 6.0; vector[2] = 8.0; vector[3] = 8.0; // 3) 計算実行. mat.SetRowVector(1, vector); // 確認) 処理結果の出力. Console.Write("CFviMatrix.SetRowVector\n"); for (int r = 0; r < mat.Rows; r++) { for (int column = 0; column < mat.Columns; column++) { Console.Write("[{0}][{1}]={2} ", r, column, mat[r, column]); } Console.Write("\n"); } } } } |
Visual Basic | Copy |
---|---|
' $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 SetRowVector() Dim rows As Integer = 3 Dim columns As Integer = 4 ' 1) インスタンスの準備. Dim mat As New FVIL.Data.CFviMatrix(rows, columns) Dim vector As New FVIL.Data.CFviVector(columns) ' 2) 行列の要素の設定. mat(0, 0) = 1.0 mat(0, 1) = 5.0 mat(0, 2) = 9.0 mat(0, 3) = 13.0 mat(1, 0) = 2.0 mat(1, 1) = 6.0 mat(1, 2) = 10.0 mat(1, 3) = 14.0 mat(2, 0) = 3.0 mat(2, 1) = 7.0 mat(2, 2) = 11.0 mat(2, 3) = 15.0 vector(0) = 3.0 vector(1) = 6.0 vector(2) = 8.0 vector(3) = 8.0 ' 3) 計算実行. mat.SetRowVector(1, vector) ' 確認) 処理結果の出力. Console.Write("CFviMatrix.SetRowVector" & vbLf) For r As Integer = 0 To mat.Rows - 1 For column As Integer = 0 To mat.Columns - 1 Console.Write("[{0}][{1}]={2} ", r, column, mat(r, column)) Next Console.Write(vbLf) Next End Sub End Class End Namespace |
CFviMatrix.SetRowVector [0][0]=1 [0][1]=5 [0][2]=9 [0][3]=13 [1][0]=3 [1][1]=6 [1][2]=8 [1][3]=8 [2][0]=3 [2][1]=7 [2][2]=11 [2][3]=15
Exceptions
Exception | Condition |
---|---|
FVIL..::..CFviException | この例外の原因については、上記のエラーコード表をご参照ください。 |