MTL vector points example

xiaoxiao2021-03-06  18

#include "mtl / mtl.h"

#include "mtl / utils.h"

#include "mtl / tinalg_vec.h"

/ *

Sample Output

[1, 2, 3,]

[3, 0, -1,]

Vectors x and y it.

* /

Using namespace MTL;

Using namespace std;

int

Main ()

{

// begin

Const int N = 3;

Double DX [] = {1, 2, 3};

Double Dy [] = {3, 0, -1};

TYPEDEF EXTERNAL_VEC VEC;

VEC X (DX, N), Y (DY, N);

Print_vector (x);

Print_vector (y);

Double dotprd = DOT (X, Y);

IF (dotprd == 0)

Cout << "vectors x and y it orthogonal." << Endl;

Else

Cout << "DOT (x, y) =" << dotprd << endl;

// end

Return 0;

}

转载请注明原文地址:https://www.9cbs.com/read-53598.html

New Post(0)