NVector类实现了SUNDIALS中的N_Vector抽象数据类型 提供向量的基本操作:创建、复制、算术运算、范数计算等
NVector
01 Syntax
Microsoft.VisualBasic.Math.Sundials.CVODE.NVector
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| .ctor | 3 | 复制构造函数 |
| Zeros | 1 | 创建全零向量 |
| Ones | 1 | 创建全1向量 |
| Constant | 1 | 创建常数向量 |
| LinSpace | 1 | 创建线性间隔向量 |
| Add | 1 | 向量加法:this = x + y |
| Subtract | 1 | 向量减法:this = x - y |
| Dot | 1 | 向量点乘 |
| MultiplyElementWise | 1 | 向量逐元素乘法 |
| DivideElementWise | 1 | 向量逐元素除法 |
| Scale | 1 | 标量乘法 |
| LinearSum | 1 | 线性组合:result = a*x + b*y |
| LinearSumInPlace | 1 | 线性组合:this = a*x + this |
| Negate | 1 | 向量取反 |
| Abs | 1 | 绝对值 |
| Sqrt | 1 | 平方根 |
| L2Norm | 1 | L2范数(欧几里得范数) |
| L1Norm | 1 | L1范数(绝对值之和) |
| InfinityNorm | 1 | 无穷范数(最大绝对值) |
| WRMSNorm | 1 | 加权RMS范数 |
| WRMSNormSquare | 1 | 加权RMS范数的平方 |
| AddConstant | 1 | 原地加法:this = this + c |
| AddVector | 1 | 原地加法:this = this + v |
| SubtractVector | 1 | 原地减法:this = this - v |
| ScaleInPlace | 1 | 原地标量乘法:this = c * this |
| MultiplyElementWiseInPlace | 1 | 原地逐元素乘法:this = this .* v |
| DivideElementWiseInPlace | 1 | 原地逐元素除法:this = this ./ v |
| SetConstant | 1 | 设置所有元素为指定值 |
| CopyFrom | 1 | 复制另一个向量的值到当前向量 |
| EqualsApprox | 1 | 比较两个向量是否相等(在容差范围内) |
| Max | 1 | 查找最大值及其索引 |
| Min | 1 | 查找最小值及其索引 |
| MaxAbs | 1 | 查找最大绝对值及其索引 |
| Clone | 1 | 克隆向量 |
| ToString | 1 | 转换为字符串 |
03 Properties
04 Members
#ctor(
Int32)创建指定长度的向量,元素初始化为0
Parameters
| Name | Type | Description |
|---|---|---|
length | Int32 | 向量长度 |
#ctor(
Double())从数组创建向量
Parameters
| Name | Type | Description |
|---|---|---|
data | Double() | 数据数组 |
#ctor(NVector)
复制构造函数
Parameters
| Name | Type | Description |
|---|---|---|
other | NVector | 要复制的向量 |
Zeros(
Int32)创建全零向量
Ones(
Int32)创建全1向量
Constant(
Int32, Double)创建常数向量
LinSpace(
Double, Double, Int32)创建线性间隔向量
向量加法:this = x + y
向量减法:this = x - y
向量点乘
向量逐元素乘法
向量逐元素除法
Scale(
Double, NVector)标量乘法
线性组合:result = ax + by
LinearSumInPlace(
Double, NVector)线性组合:this = a*x + this
Negate(NVector)
向量取反
Abs(NVector)
绝对值
Sqrt(NVector)
平方根
L2Norm
L2范数(欧几里得范数)
L1Norm
L1范数(绝对值之和)
InfinityNorm
无穷范数(最大绝对值)
WRMSNorm(NVector)
加权RMS范数
Parameters
| Name | Type | Description |
|---|---|---|
weights | NVector | 权重向量 |
WRMSNormSquare(NVector)
加权RMS范数的平方
AddConstant(
Double)原地加法:this = this + c
AddVector(NVector)
原地加法:this = this + v
SubtractVector(NVector)
原地减法:this = this - v
ScaleInPlace(
Double)原地标量乘法:this = c * this
MultiplyElementWiseInPlace(NVector)
原地逐元素乘法:this = this .* v
DivideElementWiseInPlace(NVector)
原地逐元素除法:this = this ./ v
SetConstant(
Double)设置所有元素为指定值
CopyFrom(NVector)
复制另一个向量的值到当前向量
EqualsApprox(NVector,
Double)比较两个向量是否相等(在容差范围内)
Max
查找最大值及其索引
Min
查找最小值及其索引
MaxAbs
查找最大绝对值及其索引
Clone
克隆向量
ToString
转换为字符串
Length
获取向量长度
Item(
Int32)获取或设置指定索引处的元素
Parameters
| Name | Type | Description |
|---|---|---|
index | Int32 | 索引 |
Returns
元素值
Data
获取内部数据数组的引用(只读)