Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为了使我的矩阵A与我v想要创建的向量保持同步
A
v
var vdom: domain(1) = {1...10}, mdom: domain(2) = {odom, odom};
但是,这给了我一个编译器错误。
域用range初始化。因此,您需要通过调用方法mdom从的范围内构建:vdomdim(i)
mdom
vdom
dim(i)
var vdom: domain(1) = {1...10}, mdom: domain(2) = {odom.dim(1), odom.dim(1)};
将问题空间定义为范围,然后在其他地方重新使用该变量也是一种常见模式:
const vectorSpace = 1..10; var vdom = {vectorSpace}, mdom = {vectorSpace, vectorSpace};