[add] dim: add basis, tensor: add optimize transposition

This commit is contained in:
2026-07-22 14:47:27 +02:00
parent 484d2461b6
commit 858fc6722e
2 changed files with 120 additions and 67 deletions
+18 -12
View File
@@ -38,7 +38,7 @@ TEST(size){
D->shape[2]=5;
D->shape[3]=6;
updateRankDim(D);
updateDim(D);
EXPECT_EQ(D->size, 180);
free_dimension(D);
@@ -50,7 +50,7 @@ TEST(SplitDim){
D->shape[2]=5;
D->shape[3]=6;
updateRankDim(D);
updateDim(D);
printDebug_dimension(D," D root");
dimension *d_part1 = NULL,*d_part2=NULL;
@@ -80,7 +80,7 @@ TEST(SplitDim_2){
D->shape[2]=5;
D->shape[3]=6;
updateRankDim(D);
updateDim(D);
printDebug_dimension(D," D root");
dimension *d_part1 = NULL,*d_part2=NULL;
@@ -122,8 +122,10 @@ TEST(SubDimB){
EXPECT_EQ(d_tail2->size, 15*26);
free_dimension(D);
free(d_tail2);
free(d_head2);
d_tail2->shape=NULL;
d_head2->shape=NULL;
free_dimension(d_tail2);
free_dimension(d_head2);
}
TEST(SubDim){
@@ -143,8 +145,12 @@ TEST(SubDim){
EXPECT_EQ(d_tail2->size, 5*6);
free_dimension(D);
free(d_tail2);
free(d_head2);
d_tail2->shape=NULL;
d_head2->shape=NULL;
free_dimension(d_tail2);
free_dimension(d_head2);
//free(d_tail2);
//free(d_head2);
}
TEST(Coord_linear){
@@ -154,7 +160,7 @@ TEST(Coord_linear){
D->shape[2]=5;
D->shape[3]=6;
updateRankDim(D);
updateDim(D);
size_t line=255;
size_t *coord = CoordFromLin(line,D);
@@ -175,7 +181,7 @@ TEST(signedCoord_linear){
D->shape[2]=5;
D->shape[3]=6;
updateRankDim(D);
updateDim(D);
long line=-255;
long *coord = signedCoordFromLin(line,D);
@@ -195,7 +201,7 @@ TEST(signedCoord_linearSuccessif){
D->shape[1]=3;
D->shape[2]=2;
updateRankDim(D);
updateDim(D);
for(long line=-4; line < 4; ++line){
long *coord = signedCoordFromLin(line,D);
@@ -217,7 +223,7 @@ TEST(sprint_dim){
D->shape[2]=5;
D->shape[3]=6;
updateRankDim(D);
updateDim(D);
char *dimSTR =NULL;
size_t nb=sprint_dimension(&dimSTR, D);
@@ -236,7 +242,7 @@ TEST(incrment_dim){
D->shape[2]=5;
D->shape[3]=6;
updateRankDim(D);
updateDim(D);
char *dimSTR =NULL;
size_t nb=sprint_dimension(&dimSTR, D);