nuget server logo nuget api documents
↑

API Docs / Microsoft.VisualBasic.Math.Core / SparseVector

SparseVector

Full name Microsoft.VisualBasic.Math.LinearAlgebra.SparseVector Assembly Microsoft.VisualBasic.Math.Core Members 23

稀疏的向量

00 Remarks

在这个向量中存在大量的零,主要适用于节省计算内存 因为有SparseVector.buffer索引的存在,所以假若零数值比较少的话, 使用这个稀疏向量来存储数据反而会导致内存被过度占用

01 Syntax

Microsoft.VisualBasic.Math.LinearAlgebra.SparseVector

02 Methods

NameOverloadsSummary
.ctor 2
Sum 1
GetEnumerator 1 这个枚举器函数会枚举出所有的元素,包括非零元素以及值等于零的元素
SetValue 1
Min 1
Max 1
Equals 1
op_Multiply 1
op_Division 1
op_Subtraction 1
op_Addition 1
op_Exponent 1

03 Properties

NameOverloadsSummary
Length 1 返回这个向量的虚拟长度
Dim 1 返回这个向量的虚拟长度
Values 1 返回所有的非零元素
Data 1 returns all data values in current vector object.
Item 1 Get/Set value by index access
Precision 1 All of the element its ABS value less than this precision threshold will be treated as ZERO value So the larger of this threshold value, the lower precision precision of all of th…
Array 1

04 Fields

NameOverloadsSummary
buffer 1 非零值的索引号和对应的值
dimension 1 这个向量的虚拟长度
PrecisionEnvironmentConfigName 1

05 Members

method .ctor #
#ctor(IEnumerable(Of Double), IEnumerable(Of Int32), Int32)
Parameters
NameTypeDescription
dataIEnumerable(Of Double)

非零元素值列表

indexIEnumerable(Of Int32)

非零元素对应的索引编号

lengthInt32

因为存在大量零,数组中并不是存储真实的数据,而是非零值,所以在这里必须要有一个长度来标记出当前的这个向量的长度

method .ctor overload 2 #
#ctor(IEnumerable(Of Double))

create a new sparse compact numeric vector from the given raw data

Parameters
NameTypeDescription
dataIEnumerable(Of Double)

the given raw data

method Sum #
Sum
Remarks

忽略掉所有的零值

method GetEnumerator #
GetEnumerator

这个枚举器函数会枚举出所有的元素,包括非零元素以及值等于零的元素

property Length #
Length

返回这个向量的虚拟长度

Remarks

请注意,由于buffer对象记录的是非零元素的数据记录集合,所以其元素计数并不是当前 的这个向量对象的真实长度,SparseVector.dimension的值是真实的长度

property Dim #
Dim

返回这个向量的虚拟长度

property Values #
Values

返回所有的非零元素

property Data #
Data

returns all data values in current vector object.

property Item #
Item(Int32)

Get/Set value by index access

Parameters
NameTypeDescription
indexInt32

-

property Precision #
Precision

All of the element its ABS value less than this precision threshold will be treated as ZERO value So the larger of this threshold value, the lower precision precision of all of the math algorithm that related to this SparseVector.

(当元素的绝对值小于这个值之后就会被当作为零,可以根据情况来设置这个公用属性来控制稀疏向量的计算精度)

field buffer #
buffer

非零值的索引号和对应的值

field dimension #
dimension

这个向量的虚拟长度

field PrecisionEnvironmentConfigName #
PrecisionEnvironmentConfigName
property Array #
Array
method SetValue #
SetValue(Int32, Double)
method Min #
Min()
method Max #
Max()
method Equals #
Equals(Double, Double)
method op_Multiply #
op_Multiply(SparseVector, Double)
method op_Division #
op_Division(SparseVector, Double)
method op_Subtraction #
op_Subtraction(SparseVector, Double)
method op_Addition #
op_Addition(SparseVector, Double)
method op_Exponent #
op_Exponent(SparseVector, Double)