C ++矩阵数学新手查询

时间:2018-06-05 11:46:25

标签: c++ math matrix encryption

你好我正在努力将我用java编写的加密算法转换为C ++,但我似乎无法弄清楚C ++中的矩阵乘法。我有lapacke库,并且正在生成填充了双精度的2D数组,作为预先执行操作的基础,但我如何在数组上执行实际操作。

在下面找到我到目前为止的内容:

#include <iostream>
#include <string>
#include <vector>
#include <iostream>
#include "include/lapacke.h"

using namespace std;

class construct {
public:

    string* load(string key) {
            string* kfb[] = split(key, "/");
            return kfb;
        }

        double** hologram(string blueprint) {
            string* baseArray = split(blueprint, ";");
            int size = *(&baseArray + 1) - baseArray;
            double** cluster = new double[size][10];
            for (int i = 0; i <= size - 1; i++) {
                string* temp = split(baseArray[i], ",");
                int tmpsize = *(temp + 1) - temp;
                for (int n = 0; n <= tmpsize - 1; n++) {
                    cluster[i][n] = (double) temp[n];
                }
            }
            int rows = sizeof cluster / sizeof cluster[0];
            int cols = sizeof cluster[0] / sizeof(cluster);
            return cluster;
        }

     vector<string> split(string str, string token) {
        vector<string>result;
        while (str.size()) {
            int index = str.find(token);
            if (index != string::npos) {
                result.push_back(str.substr(0, index));
                str = str.substr(index + token.size());
                if (str.size() == 0)result.push_back(str);
            }
            else {
                result.push_back(str);
                str = "";
            }
        }
        return result;
    }
}

0 个答案:

没有答案