📄 dconverse.cpp
字号:
// DCONVERSE.cpp: implementation of the DCONVERSE class.
//
//////////////////////////////////////////////////////////////////////
#include "DCONVERSE.h"
#include <stdlib.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
DCONVERSE::DCONVERSE(int dim)
{
m = new int [dim*dim];
t = new int [dim*dim];
x = new int [dim];
}
DCONVERSE::~DCONVERSE()
{
delete []m;
m = NULL;
delete []t;
t = NULL;
delete []x;
x = NULL;
}
void DCONVERSE::VtoM(int *V1, int *V2,int dim)
{
int i,j;
for(i=0; i<dim;i++)
for(j=0; j<dim;j++)
if(V2[i]==V1[j])
t[j*dim + i]=1;
else
t[j*dim + i]=0;
}
void DCONVERSE::Multi(int *M1, int *M2,int dim)
{
int i,j;
for(i=0; i<dim; i++)
for(j=0; j<dim; j++)
{
m[i*dim + j] = 0;
for(int n=0; n<dim; n++)
m[i*dim + j] += M1[i*dim +n]*M2[n*dim + j];
}
}
void DCONVERSE::XandV(int *xx, int *vv,int dim)
{
int i;
for(i=0; i<dim; i++)
{
x[i] = 0;
for(int m=0; m<dim; m++)
x[i] += xx[m]*vv[m*dim + i];
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -