ベクトルの生成

Namespace: fvalgcli
Assembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)

Syntax

C#
public static FVECTOR_PTR fnFIE_mat_valloc(
	int dim
)
Visual Basic
Public Shared Function fnFIE_mat_valloc ( 
	dim As Integer
) As FVECTOR_PTR

Parameters

dim
Type: System..::..Int32
ベクトルの次元(要素数) (0<dim<2^29)

Return Value

Type: FVECTOR_PTR
確保したベクトルを返します。メモリ不足により異常終了した場合は、IntPtr.Zero を返します。 使用後は Dispose()()()() または fnFIE_mat_vfree(FVECTOR_PTR) で解放してください。

Remarks

Examples

C# Copy imageCopy
//    $Revision: 1.1 $

using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;

namespace TC
{
    public partial class FIE
    {
        [FvPluginExecute]
        public void fnFIE_mat_valloc()
        {
            // 次元3のベクトル v を確保
            FVECTOR_PTR v = FVECTOR_PTR.Zero;

            try
            {
                v = api.fnFIE_mat_valloc(3);
                Assert.IsTrue(v != FVECTOR_PTR.Zero, "エラーが発生しました。");
                // v を次元10にリサイズ
                int status = api.fnFIE_mat_vrealloc(v, 10);
                Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
            }
            finally
            {
                //解放
                api.fnFIE_mat_vfree(v);
            }
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli

Public Partial Class FIE
    <FvPluginExecute> _
    Public Sub fnFIE_mat_valloc()
        ' 次元3のベクトル v を確保
        Dim v As FVECTOR_PTR = FVECTOR_PTR.Zero

        Try
            v = api.fnFIE_mat_valloc(3)
            Assert.IsTrue(v <> FVECTOR_PTR.Zero, "エラーが発生しました。")
            ' v を次元10にリサイズ
            Dim status As Integer = api.fnFIE_mat_vrealloc(v, 10)
            Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
        Finally
            '解放
            api.fnFIE_mat_vfree(v)
        End Try
    End Sub
End Class

See Also