矩陣的一些操作

2021-03-31 08:57:00 字數 2447 閱讀 7337

/***********************typedef.h***************/

#define true               1

#define false              0

#define ok                 1

#define error              0

#define infeasivle        -1

#define overflow          -2

#define list_init_size   100

#define listincrement     10

#define equal              1

#define stack_init_size  100

#define stackincrement    10

#define max              100

#define maxsize          100

/*********************triplet.h*********************/

#include

#include

#include

#include

typedef int *triplet;

typedef struct tripletriple;

typedef struct rl**atrixrl**atrix;

status inittriplet();

status destroytriplet();

status get();

status put();

status isascendin();

status isdescending();

status max();

status min();

void printtriplet();     /*not in general use,only for multiplication.c */

status mult**atrix();    /*not in general use,only for multiplication.c */

status scanmatrix();     /*not in general use,only for multiplication.c */

/*not in general use,only for t**atrix.c */

status fasttranspose**atrix();

status inittriplet(triplet *t, elemtype v1,elemtype v2,elemtype v3)

status destroytriplet(triplet t)

status get (triplet t,int i,elemtype *e)

status put (triplet t,int i,elemtype *e)

status isascending(triplet t)

status isdescending(triplet t)

status max(triplet t,elemtype *e)

status min(triplet t,elemtype *e)

void printtriplet(rl**atrix m)

else printf("%-6d",0);

}

printf("/n");

}

puts("/n");

}

status mult**atrix(rl**atrix m,rl**atrix n,rl**atrix *q)

q->mu=m.mu;q->nu=n.nu;q->tu=0;

if(m.tu*n.tu!=0)

for(ccol=1;ccol<=q->nu;++ccol)

if(ctemp[ccol])

}

}

return ok;

}

status scanmatrix(rl**atrix *m)

for(i=1;i<=m->mu;i++)

sum[i]=0;

for(i=1;i<=m->tu;++i)

++sum[m->data[i].i];

m->rpos[1]=1;

for(i=2;i<=m->mu;++i)

m->rpos[i]=m->rpos[i-1]+sum[i-1];

}

}

status fasttranspose**atrix(rl**atrix m,rl**atrix *t)

}

return ok;

}

矩陣的一些操作

發現python的一些矩陣操作都是用numpy來做的,如果脫離了這個庫,似乎就沒了。自己寫了幾個矩陣的操作,留在這裡做備份。逆時針旋轉 90 def rotate dataset if not dataset return none row len dataset col len dataset 0...

OpenCV 對陣列(矩陣)的一些操作

opencv operations on arrays 對陣列 矩陣 的一些操作 function 函式名 use 函式用處 add 矩陣加法,a b的更高階形式,支援mask scaleadd 矩陣加法,一個帶有縮放因子dst i scale src1 i src2 i addweighted 矩...

numpy對於矩陣的一些基本操作

import numpy as np n1 np.array 1,2 3,4 n2 np.array 1,2 3,6 矩陣加矩陣,對應位置相加,但是shape必須相同 也就是必須都是2 2的 print n1 n2 2 4 6 10 矩陣與標量相加,就是將標量挨個加到矩陣元素中去 print n1 ...

Opencv Mat矩陣的一些基本操作和遇過的問題

1 mat矩陣值傳遞的時候,如果在函式內部型別發生改變時候,傳出來的資料會變化,所以需要在函式內部重新複製一塊區域給他,才能傳出想要的mat void getdes mat des void main 2 使用colrange 和rowrange 對矩陣進行擴充 mat commatr mat ma...

ubuntu的一些操作

1.ubuntu,windows啟動順序修改 圖形化方法 sudo apt get install startupmanager,然後終端startupmanager,圖形化修改啟動順序,其它 2.ubuntu遠端桌面 window xp訪問ubuntu 需在ubuntu設定允許遠端訪問,可以加密訪...