一段程序看不懂,高手帮忙读一下
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了一段程序看不懂,高手帮忙读一下相关的知识,希望对你有一定的参考价值。
好像是关于读进内存池之类的,其中2个结构体的成员变量看不懂应该不影响阅读
typedef struct _NODE_DATA
char szName[256];
int nNodeID;
int nCalcID;
int nVolGradeID;
int nType;
double fVoltage;
double fPhase;
double fVolreal;
double fVolimag;
double fVolMax;
double fVolMin;
double fP;
double fQ;
NodeData, *PNodeData;
struct SharedBlock;
extern HANDLE ghDataLock;
extern SharedBlock* gpSharedBlock;
//shared data struct
struct SharedBlock
int nFlag;
int nNodeCount;
int nPQNodeCount;
int nPVNodeCount;
int nBranchCount;
char _based(gpSharedBlock) *pNode[1024];
char _based(gpSharedBlock) *pBranch[1024];
;
class CSharedMemApp : public CWinApp
public:
CSharedMemApp();
// Overrides
// ClassWizard generated virtual function overrides
//AFX_VIRTUAL(CSharedMemApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//AFX_VIRTUAL
//AFX_MSG(CSharedMemApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//AFX_MSG
DECLARE_MESSAGE_MAP()
;
HANDLE ghDataLock;
HANDLE ghFileMapping;
BOOL CSharedMemApp::InitInstance()
ghDataLock = ::CreateMutex(NULL, TRUE, "ShareMem Data Mutex");
VERIFY( ghDataLock != NULL );
ghFileMapping = ::CreateFileMapping(
(HANDLE)0xFFFFFFFF, // File handle
NULL, // Security attributes
PAGE_READWRITE, // Protection
0, // Size - high 32 bits
1<<24, // Size - low 32 bits
"NLPowerFlow Data Block"); // Name
VERIFY( ghFileMapping != NULL );
DWORD dwMapErr = GetLastError();
gpSharedBlock = (SharedBlock*) ::MapViewOfFile(
ghFileMapping,
FILE_MAP_ALL_ACCESS, // Read/Write
0, // Offset - high 32 bits
0, // Offset - low 32 bits
0); // Map the whole thing
VERIFY( gpSharedBlock != NULL );
// Only initialize shared memory if we actually created.
if (dwMapErr != ERROR_ALREADY_EXISTS)
memset(gpSharedBlock, 0, sizeof(SharedBlock));
::ReleaseMutex(ghDataLock);
return CWinApp::InitInstance();
bool APIENTRY ReadNodeData(int nIndex, NodeData* pNodeData)
bool bRet = false;
// Make sure the shared memory is available
::WaitForSingleObject(ghDataLock, INFINITE);
if(gpSharedBlock != NULL )
if(nIndex < gpSharedBlock->nNodeCount)
memcpy(pNodeData, gpSharedBlock->pNode[nIndex], sizeof(NodeData));
bRet = true;
::ReleaseMutex(ghDataLock);
return bRet;
错了,最后一个ReadNodeData()函数应该替换成
bool APIENTRY AddtoNodeData(NodeData* pNodeData)
::WaitForSingleObject(ghDataLock, INFINITE);
bool bRet = false;
if(gpSharedBlock != NULL )
if( gpSharedBlock->nNodeCount < 1024 )
char *lpDataBuffer = (char*)gpSharedBlock + sizeof(SharedBlock) +
gpSharedBlock->nNodeCount * sizeof(NodeData);
memcpy(lpDataBuffer, pNodeData, sizeof(NodeData));
gpSharedBlock->pNode[gpSharedBlock->nNodeCount] = (char _based(gpSharedBlock) *)lpDataBuffer;
(gpSharedBlock->nNodeCount)++;
if(pNodeData->nType == 1)
(gpSharedBlock->nPQNodeCount)++;
else if(pNodeData->nType == 2)
(gpSharedBlock->nPVNodeCount)++;
bRet = true;
::ReleaseMutex(ghDataLock);
return bRet;
请高手帮忙分析下SPSS的多元线性回归结果吧~急啊~~~
下面是线性回归出来的四个图。。。看不懂啊。。。请高手帮个忙,是写在论文里的,所以请稍微详细点说说吧~主要是三个变量和Y的拟合度怎么样,如何看的~~谢谢了~~~
Variables Entered/Removed(b)
Model Variables Entered Variables Removed Method
1 X3, X2, X1(a) . Enter
a All requested variables entered.
b Dependent Variable: Y
Model Summary
Model R R Square Adjusted R Square Std. Error of the Estimate
1 .823(a) .678 .664 4.60955
a Predictors: (Constant), X3, X2, X1
ANOVA(b)
Model Sum of Squares df Mean Square F Sig.
1 Regression 3170.063 3 1056.688 49.731 .000(a)
Residual 1508.604 71 21.248
Total 4678.667 74
a Predictors: (Constant), X3, X2, X1
b Dependent Variable: Y
Coefficients(a)
Model Unstandardized Coefficients Standardized Coefficients t Sig.
B Std. Error Beta
1 (Constant) -4.517 1.517 -2.978 .004
X1 -2.79E-005 .000 -.144 -.174 .863
X2 .076 .008 .693 9.355 .000
X3 7.40E-005 .000 .398 .483 .631
a Dependent Variable: Y
图片
拟合优度R方等于0.678,表示自变量可以解释因变量的67.8%变化,说明拟合优度还可以。
方差检验表中F值对应的概率P值为0.000,小于显著度0.05,因此应拒绝原假设,说明自变量和因变量之间存在显著的线性关系。
参数检验表中只有自变量X2和常数项的概率P值为0.000,小于显著度0.05,而自变量X1和X3的概率P值大于显著度0.05,说明只有自变量X2对因变量在总体中存在显著的线性关系,X1、X3和因变量在总体中不存在显著的线性关系。
得到的线性方程为:y=-4.517-0.000028X1+0.76X2+0.000074X3(记住这里用的是直接进入法进行拟合方程的,所以即使X1和X3没通过检验,也要放到方程中去)本回答被提问者采纳
以上是关于一段程序看不懂,高手帮忙读一下的主要内容,如果未能解决你的问题,请参考以下文章
书上有个例题看不懂啊,二叉树查找数据元素,C高手帮帮忙 O_O (菜鸟在线)
要把ubuntu直接装进硬盘,fdisk一下了,看不懂,高手来指点一下啊(联想电脑的)
求高手帮忙翻译一段基于OPENCV的运动目标检测的程序,详细翻译,老师会提问