ファイルを処理しています。以下のようなコンテンツのフォーマットは次のとおりです。Fortransと同等のC++構文
name - problem name (A string value)
m - number or rows (int value)
n - number of columns (int value)
Ap - pointers to the begining of storage of column (size n+1)(an array of size (n+1))
Ai - row indices for each non zero entry (input, nnz A)
Ax - non zero entries (input, nnz A)
b - right hand side (input, size m)(an double array of size m)
c - objective vector (minimize, size n) (an double array of size n))
z0 - initial fixed value for objective (double value)
lobnd - lower bounds on variables (size n) (an double array of size n)
upbnd - upper bounds on variables (size n) (an double array of size n)
を構文はFORTRANでこのファイルを読み込むための、次のとおりです。
Ap (j) = location of start of column j
Ai (Ap (j)) through Ai (Ap (j+1)-1) are the row indices in column j
Ax (Ap (j)) through Ax (Ap (j+1)-1) are the numerical values in column j
read(file,'(a8)') name
read(file,*) m,n
read(file,*) (ia(i),i=1,n+1)
read(file,*) (ja(i),i=1,ia(n+1)-1)
read(file,*) (a(i),i=1,ia(n+1)-1)
read(file,*) (b(i),i=1,m)
read(file,*) (c(i),i=1,n)
read(file,*) z0
read(file,*) (lobnd(i),i=1,n)
read(file,*) (upbnd(i),i=1,n)
私はC++で対応する構文を知りたいです。このプログラムをFortranからC++に変換する方法は誰にも分かりますか? Here is an example of an file .
ここでは、ファイル形式の説明によると、上記のファイル内
name = 'BLEND'
m = 74
n = 114
upbnd = I can see the n or 114 double values at the end of the file
lobnd = I can see the n or 114 double values before the values of upbnd
z0 = here I can see 0. is the value of z0
c = I can see n or 114 values before z0 in the file and understand this
b = I understand the right hand side and I can see the m or 74 values
Ai - I understand row indices for each non zero entry (input, nnz A)
Ax - non zero entries (input, nnz A)
Now I can not understand the following values in the file:
Ap = I can not understand what do these (n+1) or 115 integers mean
私は、ファイルにこののAβ値を理解したいです。ありがとうございます。
これまでに何を試しましたか? –
いくつかのファイルのリンクを提供してください –
**間違ったアプローチ** Fortranで思考しながらC++でコード化しないでください。良いC++プログラミング(http://stroustrup.com/Programming/)の本を読んで、標準のC++ [コンテナ](http://en.cppreference.com/w/cpp/container)を使って週を過ごす –