.. index:: pair: class; gpr::linalg::schemeii::Context .. _doxid-classgpr_1_1linalg_1_1schemeii_1_1_context: class gpr::linalg::schemeii::Context ==================================== .. toctree:: :hidden: struct_gpr_linalg_schemeii_Context_Impl.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class Context { public: // structs struct :ref:`Impl`; // construction :target:`Context`(:ref:`Options` options); :target:`Context`(const Context&); :target:`~Context`(); // methods :ref:`Context`& :target:`operator=`(const :ref:`Context`&); const :ref:`Options`& :target:`options`() const; std::string :ref:`describe`(std::int64_t k) const; :ref:`Plan` :target:`plan`(std::int64_t k) const; void :ref:`setThreadSource`(int(*)() source); :ref:`Operand` :ref:`prepareRows`(const double* a, std::int64_t lda, bool transpose, std::int64_t m, std::int64_t k, const :ref:`Plan`& plan, const int* exponents = nullptr) const; :ref:`Operand` :ref:`prepareColumns`(const double* b, std::int64_t ldb, bool transpose, std::int64_t k, std::int64_t n, const :ref:`Plan`& plan, const int* exponents = nullptr) const; void :ref:`run`(std::span`> tasks) const; void :ref:`gemm`(bool transpose_a, bool transpose_b, std::int64_t m, std::int64_t n, std::int64_t k, double alpha, const double* a, std::int64_t lda, const double* b, std::int64_t ldb, double beta, double* c, std::int64_t ldc) const; void :ref:`residues`(const :ref:`Task`& task, std::vector& out) const; void :ref:`reconstruct`(const :ref:`Plan`& plan, std::span residues, std::span row_exponents, std::span column_exponents, std::int64_t m, std::int64_t n, double alpha, double beta, double* c, std::int64_t ldc) const; }; .. _details-classgpr_1_1linalg_1_1schemeii_1_1_context: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Methods ------- .. index:: pair: function; describe .. _doxid-classgpr_1_1linalg_1_1schemeii_1_1_context_1aeb4fae4871a29c46ffa4b576fc788735: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string describe(std::int64_t k) const One line naming engine, provider, bits and moduli for k. .. index:: pair: function; setThreadSource .. _doxid-classgpr_1_1linalg_1_1schemeii_1_1_context_1a8435f8399b60de4d37ea6178a91da965: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setThreadSource(int(*)() source) Thread count used when :ref:`Options::threads ` is zero. .. index:: pair: function; prepareRows .. _doxid-classgpr_1_1linalg_1_1schemeii_1_1_context_1a6638a4eae4b7615c0905420f2e0f9912: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Operand` prepareRows(const double* a, std::int64_t lda, bool transpose, std::int64_t m, std::int64_t k, const :ref:`Plan`& plan, const int* exponents = nullptr) const Row operand from op(A) (m x k). Exponents override the row maxima. .. index:: pair: function; prepareColumns .. _doxid-classgpr_1_1linalg_1_1schemeii_1_1_context_1af8b612b1823cb7c105e7ecb887a6c82f: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Operand` prepareColumns(const double* b, std::int64_t ldb, bool transpose, std::int64_t k, std::int64_t n, const :ref:`Plan`& plan, const int* exponents = nullptr) const Column operand from op(B) (k x n). .. index:: pair: function; run .. _doxid-classgpr_1_1linalg_1_1schemeii_1_1_context_1aae0610633f5926c0e3b4b875bf09095a: .. ref-code-block:: cpp :class: doxyrest-title-code-block void run(std::span`> tasks) const Runs every task; the outputs must not overlap and all tasks share k. Throws on a non-finite result. .. index:: pair: function; gemm .. _doxid-classgpr_1_1linalg_1_1schemeii_1_1_context_1a2a9d5f857c7e6d41d76023d9a2674b74: .. ref-code-block:: cpp :class: doxyrest-title-code-block void gemm(bool transpose_a, bool transpose_b, std::int64_t m, std::int64_t n, std::int64_t k, double alpha, const double* a, std::int64_t lda, const double* b, std::int64_t ldb, double beta, double* c, std::int64_t ldc) const C = alpha op(A) op(B) + beta C with column-major storage. Workspace is bounded by :ref:`Options::panel_bytes ` plus the block residues. .. index:: pair: function; residues .. _doxid-classgpr_1_1linalg_1_1schemeii_1_1_context_1a00169445ae96a2f6f613d81172aa65ba: .. ref-code-block:: cpp :class: doxyrest-title-code-block void residues(const :ref:`Task`& task, std::vector& out) const Residues in [0, p_t) of A'B' for the block of a task, stored as out[t \* m \* n + i + j \* m]. With a split inner dimension, sum these over the parts modulo p_t (exact in int64) and pass the sums to :ref:`reconstruct() `; prepare every part with the exponents of the whole rows and columns and the plan of the whole k. .. index:: pair: function; reconstruct .. _doxid-classgpr_1_1linalg_1_1schemeii_1_1_context_1adb87cf52f7bd6fbb5fed87b661c2efb5: .. ref-code-block:: cpp :class: doxyrest-title-code-block void reconstruct(const :ref:`Plan`& plan, std::span residues, std::span row_exponents, std::span column_exponents, std::int64_t m, std::int64_t n, double alpha, double beta, double* c, std::int64_t ldc) const C block from summed residues (see :ref:`residues() `).