2010年7月28日 星期三

Matlab , inner , outer, tensor Product

from here :http://www.mathworks.com/access/helpdesk/help/techdoc/math/f4-988203.html

outer:
u = [3; 1; 4]; v = [2 0 -1];
x = v*u
x = 2
X = u*v
X = 6 0 -3
2 0 -1
8 0 -4

inner :
we often use the transform operator x' . i think it is easy for u to understand , so dont do explain.


tensor :

The Kronecker product is often used with matrices of zeros and ones to build up repeated copies of small matrices. For example, if X is the 2-by-2 matrix

X =       
1 2
3 4

and I = eye(2,2) is the 2-by-2 identity matrix, then the two matrices

kron(X,I)

and

kron(I,X)

are

       1     0     2     0       
0 1 0 2
3 0 4 0
0 3 0 4

and

1     2     0     0       
3 4 0 0
0 0 1 2
0 0 3 4

2010年6月19日 星期六

C+ OpenFileDialog Example

OpenFileDialog^ fDialog = gcnew OpenFileDialog();


if(fDialog->ShowDialog()==System::Windows::Forms::DialogResult::OK){

To_string(fDialog->FileName,fileName1);

}

System::String -> std::string

fucking droublesome!!!!
spend me more than 1hour !!!

buddy can check here , a good way to convert :http://blogs.msdn.com/b/slippman/archive/2004/06/02/147090.aspx


bool To_CharStar( String^ source, char*& target )

{

int len = (( source->Length+1) * 2);

target = new char[ len ];

pin_ptr wch = PtrToStringChars( source );

return wcstombs( target, wch, len ) != -1;

}



bool To_string( String^ source, string &target )

{

int len = (( source->Length+1) * 2);

char *ch = new char[ len ];

bool result ;

{

pin_ptr wch = PtrToStringChars( source );

result = wcstombs( ch, wch, len ) != -1;

}

target = ch;

delete ch;

return result;

}

2010年6月4日 星期五

C# PictureBox with Image class

            Image ig = Image.FromFile("G:\\C++pj\\testImage\\testImage\\figure1.jpg");
           
           

            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.pictureBox1.Image = ig;


2010年4月25日 星期日

Matlab Plot( x, y)

x = -pi:.1:pi;
y = sin(x);
plot(x,y)


2010年2月16日 星期二

define self class item [ x, y]

class Peter{
int Num[n,n];


public int this[int x,int y]{

get{ return Num[n,n];}
set{Num[n,n]=value;}

}
}

different between twoDim.getlength( ) and twoDim.length

int[9,9] twoDim;

twoDim.getLength (0); // is 9
twoDim.length ; // is 81