include/tenzr/scipy/scipy.h
Namespaces
Classes
Source code
// Copyright 2026 The Tenzr Project Authors
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef TENZR_SCIPY_SCIPY_H_
#define TENZR_SCIPY_SCIPY_H_
#include <functional>
#include <optional>
#include <string>
#include <vector>
#include "tenzr/array.h"
#include "tenzr/common/export.h"
namespace tenzr::scipy {
namespace special {
[[nodiscard]] TENZR_API Array Erf(const Array& x);
[[nodiscard]] TENZR_API Array Erfc(const Array& x);
[[nodiscard]] TENZR_API Array Gamma(const Array& x);
[[nodiscard]] TENZR_API Array Gammaln(const Array& x);
[[nodiscard]] TENZR_API Array Logit(const Array& x);
[[nodiscard]] TENZR_API Array Expit(const Array& x);
[[nodiscard]] TENZR_API Array Logsumexp(const Array& x, std::optional<std::vector<int64_t>> axis = std::nullopt, bool keepdims = false);
[[nodiscard]] TENZR_API Array softmax(const Array& x, int64_t axis = -1);
} // namespace special
namespace linalg {
[[nodiscard]] TENZR_API Array Det(const Array& A);
[[nodiscard]] TENZR_API Array Inv(const Array& A);
[[nodiscard]] TENZR_API Array Solve(const Array& A, const Array& b);
[[nodiscard]] TENZR_API Array Cholesky(const Array& A, bool lower = true);
} // namespace linalg
namespace optimize {
struct OptimizeResult {
Array x;
Array fun;
bool success{false};
int nit{0};
std::string message;
};
[[nodiscard]] TENZR_API OptimizeResult MinimizeCg(const std::function<Array(const Array&)>& fn, const Array& x0, int maxiter = 100, double tol = 1.0e-5);
[[nodiscard]] TENZR_API OptimizeResult MinimizeBfgs(const std::function<Array(const Array&)>& fn, const Array& x0, int maxiter = 100, double tol = 1.0e-5);
} // namespace optimize
} // namespace tenzr::scipy
namespace tenzr {
namespace tsp = tenzr::scipy;
} // namespace tenzr
#endif // TENZR_SCIPY_SCIPY_H_