summaryrefslogtreecommitdiff
path: root/packages/base/src/Internal/C/lapack-aux.c
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src/Internal/C/lapack-aux.c')
-rw-r--r--packages/base/src/Internal/C/lapack-aux.c101
1 files changed, 40 insertions, 61 deletions
diff --git a/packages/base/src/Internal/C/lapack-aux.c b/packages/base/src/Internal/C/lapack-aux.c
index 063e601..7da6f6a 100644
--- a/packages/base/src/Internal/C/lapack-aux.c
+++ b/packages/base/src/Internal/C/lapack-aux.c
@@ -3,6 +3,8 @@
3#include <string.h> 3#include <string.h>
4#include <math.h> 4#include <math.h>
5#include <time.h> 5#include <time.h>
6#include <inttypes.h>
7
6#include "lapack-aux.h" 8#include "lapack-aux.h"
7 9
8#define MACRO(B) do {B} while (0) 10#define MACRO(B) do {B} while (0)
@@ -1300,6 +1302,18 @@ int multiplyI(KOIMAT(a), KOIMAT(b), OIMAT(r)) {
1300 OK 1302 OK
1301} 1303}
1302 1304
1305int multiplyL(KOLMAT(a), KOLMAT(b), OLMAT(r)) {
1306 { TRAV(r,i,j) {
1307 int k;
1308 AT(r,i,j) = 0;
1309 for (k=0;k<ac;k++) {
1310 AT(r,i,j) += AT(a,i,k) * AT(b,k,j);
1311 }
1312 }
1313 }
1314 OK
1315}
1316
1303 1317
1304////////////////// sparse matrix-product /////////////////////////////////////// 1318////////////////// sparse matrix-product ///////////////////////////////////////
1305 1319
@@ -1331,67 +1345,23 @@ int smTXv(KDVEC(vals),KIVEC(cols),KIVEC(rows),KDVEC(x),DVEC(r)) {
1331 1345
1332//////////////////// transpose ///////////////////////// 1346//////////////////// transpose /////////////////////////
1333 1347
1334int transF(KFMAT(x),FMAT(t)) { 1348#define TRANS_IMP { \
1335 REQUIRES(xr==tc && xc==tr,BAD_SIZE); 1349 REQUIRES(xr==tc && xc==tr,BAD_SIZE); \
1336 DEBUGMSG("transF"); 1350 DEBUGMSG("trans"); \
1337 int i,j; 1351 int i,j; \
1338 for (i=0; i<tr; i++) { 1352 for (i=0; i<tr; i++) { \
1339 for (j=0; j<tc; j++) { 1353 for (j=0; j<tc; j++) { \
1340 tp[i*tc+j] = xp[j*xc+i]; 1354 tp[i*tc+j] = xp[j*xc+i]; \
1341 } 1355 } \
1342 } 1356 } \
1343 OK 1357 OK }
1344} 1358
1345 1359int transF(KFMAT(x),FMAT(t)) TRANS_IMP
1346int transR(KDMAT(x),DMAT(t)) { 1360int transR(KDMAT(x),DMAT(t)) TRANS_IMP
1347 REQUIRES(xr==tc && xc==tr,BAD_SIZE); 1361int transQ(KQMAT(x),QMAT(t)) TRANS_IMP
1348 DEBUGMSG("transR"); 1362int transC(KCMAT(x),CMAT(t)) TRANS_IMP
1349 int i,j; 1363int transI(KIMAT(x),IMAT(t)) TRANS_IMP
1350 for (i=0; i<tr; i++) { 1364int transL(KLMAT(x),LMAT(t)) TRANS_IMP
1351 for (j=0; j<tc; j++) {
1352 tp[i*tc+j] = xp[j*xc+i];
1353 }
1354 }
1355 OK
1356}
1357
1358int transQ(KQMAT(x),QMAT(t)) {
1359 REQUIRES(xr==tc && xc==tr,BAD_SIZE);
1360 DEBUGMSG("transQ");
1361 int i,j;
1362 for (i=0; i<tr; i++) {
1363 for (j=0; j<tc; j++) {
1364 tp[i*tc+j] = xp[j*xc+i];
1365 }
1366 }
1367 OK
1368}
1369
1370int transC(KCMAT(x),CMAT(t)) {
1371 REQUIRES(xr==tc && xc==tr,BAD_SIZE);
1372 DEBUGMSG("transC");
1373 int i,j;
1374 for (i=0; i<tr; i++) {
1375 for (j=0; j<tc; j++) {
1376 tp[i*tc+j] = xp[j*xc+i];
1377 }
1378 }
1379 OK
1380}
1381
1382
1383int transI(KIMAT(x),IMAT(t)) {
1384 REQUIRES(xr==tc && xc==tr,BAD_SIZE);
1385 DEBUGMSG("transI");
1386 int i,j;
1387 for (i=0; i<tr; i++) {
1388 for (j=0; j<tc; j++) {
1389 tp[i*tc+j] = xp[j*xc+i];
1390 }
1391 }
1392 OK
1393}
1394
1395 1365
1396//////////////////////// extract ///////////////////////////////// 1366//////////////////////// extract /////////////////////////////////
1397 1367
@@ -1431,6 +1401,11 @@ int extractI(int modei, int modej, KIVEC(i), KIVEC(j), KOIMAT(m), OIMAT(r)) {
1431 EXTRACT_IMP 1401 EXTRACT_IMP
1432} 1402}
1433 1403
1404int extractL(int modei, int modej, KIVEC(i), KIVEC(j), KOLMAT(m), OLMAT(r)) {
1405 EXTRACT_IMP
1406}
1407
1408
1434//////////////////////// remap ///////////////////////////////// 1409//////////////////////// remap /////////////////////////////////
1435 1410
1436#define REMAP_IMP \ 1411#define REMAP_IMP \
@@ -1451,6 +1426,10 @@ int remapI(KOIMAT(i), KOIMAT(j), KOIMAT(m), OIMAT(r)) {
1451 REMAP_IMP 1426 REMAP_IMP
1452} 1427}
1453 1428
1429int remapL(KOIMAT(i), KOIMAT(j), KOLMAT(m), OLMAT(r)) {
1430 REMAP_IMP
1431}
1432
1454int remapC(KOIMAT(i), KOIMAT(j), KOCMAT(m), OCMAT(r)) { 1433int remapC(KOIMAT(i), KOIMAT(j), KOCMAT(m), OCMAT(r)) {
1455 REMAP_IMP 1434 REMAP_IMP
1456} 1435}